You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/user-docs/docs-docker.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ permalink: docs-docker
5
5
folder: docs
6
6
---
7
7
8
+
{% include toc.html %}
9
+
8
10
Singularity is good friends with Docker. The reason is because the developers use and really like using Docker, and scientists have already put much resources into creating Docker images. Thus, one of our early goals was to support Docker. What can you do?
9
11
10
12
- You don't need Docker installed
@@ -166,7 +168,7 @@ Given the definition, the `ENTRYPOINT` is most appropriate for the Singularity `
166
168
167
169
168
170
169
-
# How do I specify my Docker image?
171
+
##How do I specify my Docker image?
170
172
171
173
In the example above, you probably saw that we referened the docker image first with the uri `docker://` and that is important to tell Singularity that it will be pulling Docker layers. To ask for ubuntu, we asked for `docker://ubuntu`. This uri that we give to Singularity is going to be very important to choose the following Docker metadata items:
172
174
@@ -199,11 +201,11 @@ If you want to change any of those fields, then just specify what you want in th
199
201
200
202
201
203
202
-
# Custom Authentication
204
+
##Custom Authentication
203
205
For both import and bootstrap using a build spec file, by default we use the Docker Registry `index.docker.io`. Singularity first tries the call without a token, and then asks for one with pull permissions if the request is defined. However, it may be the case that you want to provide a custom token for a private registry. You have two options. You can either provide a `Username` and `Password` in the build specification file (if stored locally and there is no need to share), or (in the case of doing an import or needing to secure the credentials) you can export these variables to environmental variables. We provide instructions for each of these cases:
204
206
205
207
206
-
####Authentication in the Singularity Build File
208
+
### Authentication in the Singularity Build File
207
209
You can simply specify your additional authentication parameters in the header with the labels `Username` and `Password`:
208
210
209
211
```bash
@@ -213,15 +215,15 @@ Password: [password]
213
215
214
216
Again, this can be in addition to specification of a custom registry with the `Registry` parameter.
215
217
216
-
####Authentication in the Environment
218
+
### Authentication in the Environment
217
219
You can export your username, and password for Singularity as follows:
218
220
219
221
```bash
220
222
export SINGULARITY_DOCKER_USERNAME=vanessasaur
221
223
export SINGULARITY_DOCKER_PASSWORD=rawwwwwr
222
224
```
223
225
224
-
#####Testing Authentication
226
+
### Testing Authentication
225
227
If you are having trouble, you can test your token by obtaining it on the command line and putting it into an environmental variable, `CREDENTIAL`:
The above call should return the tags list as expected. And of course you should change the repo name to be one that actually exists that you have credentials for.
240
242
243
+
## Best Practices
244
+
While most docker images can import and run without a hitch, there are some special cases for which things can go wrong. Here is a general list of suggested practices, and if you discover a new one in your building ventures please <ahref="https://www.github.com/singularityware/singularityware.github.io/issues"target="_blank">let us know</a>.
245
+
246
+
### 1. Installation to Root
247
+
When using Docker, you typically run as root, meaning that root's home at `/root` is where things will install given a specification of home. This is fine when you stay in Docker, or if the content at `/root` doesn't need any kind of write access, but generally can lead to a lot of bugs because it is, after all, root's home. This leads us to best practice #1.
248
+
249
+
>> Don't install anything to root's home, `/root`.
250
+
251
+
### 2. Library Configurations
252
+
The command [ldconfig](https://codeyarns.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/) is used to update the shared library cache. If you have software that requires symbolic linking of libraries and you do the installation without updating the cache, then the Singularity image (in read only) will likely give you an error that the library is not found. If you look in the image, the library will exist but the symbolic link will not. This leads us to best practice #2:
253
+
254
+
>> Update the library cache at the end of your Dockerfile with a call to ldconfig.
255
+
256
+
257
+
Have any more best practices? Please <ahref="https://www.github.com/singularityware/singularityware.github.io/issues"target="_blank">let us know</a>!
258
+
241
259
242
260
## Troubleshooting
243
261
Why won't my image bootstrap work? If you can't find an answer on this site, please <ahref="https://www.github.com/singularityware/singularity/issues"target="_blank">ping us an issue</a>.
0 commit comments