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
+43-46Lines changed: 43 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,70 +35,61 @@ The core of a Docker image is basically a compressed set of files, a set of `.ta
35
35
36
36
37
37
## Quick Start: The Docker Registry
38
-
The Docker engine communicates with the Docker Hub via the <ahref="https://docs.docker.com/engine/reference/api/docker_remote_api/"target="_blank">Docker Remote API</a>, and guess what, we can too! The easiest thing to do is create an image, and then pipe a Docker image directly into it from the Docker Registry. You don't need Docker installed on your machine, but you will need a working internet connection. Let's create an ubuntu operating system, from Docker:
38
+
The Docker engine communicates with the Docker Hub via the <ahref="https://docs.docker.com/engine/reference/api/docker_remote_api/"target="_blank">Docker Remote API</a>, and guess what, we can too! The easiest thing to do is create an image, and then pipe a Docker image directly into it from the Docker Registry. You don't need Docker installed on your machine, but you will need a working internet connection. Let's create an ubuntu operating system, from Docker. We will pull, then build:
39
39
40
-
```bash
41
-
singularity create ubuntu.img
42
-
Initializing Singularity image subsystem
43
-
Opening image file: ubuntu.img
44
-
Creating 768MiB image
45
-
Binding image to loop
46
-
Creating file system within image
47
-
Image is done: ubuntu.img
48
-
```
49
-
50
-
Note that the default size is 768MB, you can modify this by adding the `--size` or `-s` argument like:
51
-
52
-
```bash
53
-
singularity create --size 2000 ubuntu.img
54
-
```
55
-
56
-
If you aren't sure about the size? Try <ahref="https://asciinema.org/a/103492?speed=3"target="_blank">building into a folder first</a>.
57
-
58
-
```bash
59
-
mkdir fatty
60
-
singularity import fatty docker://ubuntu:latest
61
-
du -sh fatty/
62
-
```
63
-
64
-
Next, let's import a Docker image into it!
65
40
66
41
```bash
67
-
singularity import ubuntu.img docker://ubuntu
42
+
singularity pull docker://ubuntu
43
+
WARNING: pull for Docker Hub is not guaranteed to produce the
44
+
WARNING: same image on repeated pull. Use Singularity Registry
45
+
WARNING: (shub://) to pull exactly equivalent images.
WARNING: Building container as an unprivileged user. If you run this container as root
57
+
WARNING: it may be missing some functionality.
58
+
Building Singularity image...
59
+
Cleaning up...
60
+
Singularity container built: ./ubuntu.img
80
61
```
81
62
63
+
The warnings mean well - it is to tell you that you are creating the image on the fly from layers, and if one of those layers changes, you won't produce the same image next time.
64
+
82
65
## The Build Specification file, Singularity
83
-
Just like Docker has the Dockerfile, Singularity has a file called Singularity that (currently) applications like Singularity Hub know to sniff for. For reproducibility of your containers, our strong recommendation is that you build from these files. Any command that you issue to change a container with `--writable` is by default not recorded, and your container loses its reproducibility. So let's talk about how to make these files! First, let's look at the absolute minimum requirement:
66
+
Just like Docker has the Dockerfile, Singularity has a file called Singularity that (currently) applications like Singularity Hub know to sniff for. For reproducibility of your containers, our strong recommendation is that you build from these files. Any command that you issue to change a container sandbox (building with `--sandbox`) or to a build with `--writable` is by default not recorded, and your container loses its reproducibility. So let's talk about how to make these files! First, let's look at the absolute minimum requirement:
84
67
85
68
```bash
86
69
Bootstrap: docker
87
-
From: tensorflow/tensorflow:latest
70
+
From: ubuntu
88
71
```
89
72
90
73
We would save this content to a file called `Singularity` and then issue the following commands to bootstrap the image from the file
Note that the default is `latest`. If you want to customize the Registry or Namespace, just add those to the header:
87
+
88
+
```
89
+
Bootstrap: docker
90
+
From: ubuntu
91
+
Registry: pancakes.registry.index.io
92
+
Namespace: blue/berry/cream
102
93
```
103
94
104
95
The power of bootstrap comes with the other stuff that you can do! This means running specific install commands, specifying your containers runscript (what it does when you execute it), adding files, labels, and customizing the environment. Here is a full Singularity file:
You can have one or the other, both are considered a "digest" in Docker speak.
196
187
197
-
If you want to change any of those fields, then just specify what you want in the URI.
188
+
If you want to change any of those fields and are having trouble with the uri, you can also just state them explicitly:
198
189
199
190
191
+
```
192
+
Bootstrap: docker
193
+
From: ubuntu
194
+
Registry: index.docker.io
195
+
Namespace: library
196
+
```
200
197
201
198
## Custom Authentication
202
199
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:
0 commit comments