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: README.md
+92-2Lines changed: 92 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,43 @@
1
1
# `docker2singularity`
2
2
3
-
Are you developing Docker images and you would like to run them on an HPC cluster supporting [Singularity](http://singularity.lbl.gov)? Are you working on Mac or Windows with no easy access to a Linux machine? If the pull, import, and general commands to [work with docker images provided by Singularity](http://singularity.lbl.gov/docs-docker) natively do not fit your needs, `docker2singularity` is an alternative way to generate Singularity images. This particular branch is intended for Singularity 2.4, which builds a squashfs image. If you want a legacy version to build ext3 images, see the following other branches:
3
+
Are you developing Docker images and you would like to run them on an HPC cluster supporting [Singularity](http://singularity.lbl.gov)? Are you working on Mac or Windows with no easy access to a Linux machine? If the pull, import, and general commands to [work with docker images provided by Singularity](http://singularity.lbl.gov/docs-docker) natively do not fit your needs, `docker2singularity` is an alternative way to generate Singularity images. This particular branch is intended for Singularity 2.4, which gives you a selection of image formats to build.
-`default` (no arguments specified) gives you a squashfs (`*.simg`) image. This is a compressed, reliable, and read only format that is recommended for production images.
24
+
-`-f` builds your image into a sandbox folder. This is ideal for development, as it will produce a working image in a folder on your system.
25
+
-`-w` builds an older format (ext3) image (`*.img`) with `--writable`. This format is not recommended for production images as we have observed degradation of the images over time, and they tend to be upwards of 1.5x to 2x the size of squashfs.
26
+
27
+
Note that you are able to convert easily from a folder or ext3 image using Singularity 2.4, if your choice is to develop, making changes, and then finalize. This approach is **not** recommended - your changes are not recorded and thus the image not reproducible.
28
+
29
+
**Mount Points**
30
+
31
+
-`-m` specify one or more mount points to create in the image.
32
+
33
+
**Image Name**
34
+
35
+
The last argument (without a letter) is the name of the docker image, as you would specify to run with Docker (e.g., `docker run ubuntu:latest`)
36
+
37
+
38
+
## Legacy
39
+
40
+
If you want a legacy version, see the following other branches:
4
41
5
42
-[v2.3](https://github.com/singularityware/docker2singularity/tree/v2.3): Version 2.3 of Singularity. The image format is ext3.
6
43
-[v2.4](https://github.com/singularityware/docker2singularity/tree/v2.4): Version 2.4 of Singularity. The default image format is squashfs.
@@ -12,7 +49,7 @@ Intermediate versions built on [Docker Hub](https://hub.docker.com/r/singularity
12
49
- Docker (native Linux or Docker for Mac or Docker for Windows) - to create the Singularity image.
13
50
- Singularity >= 2.1 - to run the Singularity image (**versions 2.0 and older are not supported!**). Note that if running a 2.4 image using earlier versions, not all (later developed) features may be available.
14
51
15
-
## Usage
52
+
## Examples
16
53
17
54
No need to download anything from this repository! Simply type:
18
55
@@ -29,6 +66,58 @@ Replace `D:\host\path\where\to\output\singularity\image` with a path on the host
29
66
30
67
`docker2singularity` uses the Docker daemon located on the host system. It will access the Docker image cache from the host system avoiding having to redownload images that are already present locally.
31
68
69
+
## Build a Squashfs Image
70
+
Squashfs is the recommended image type, it is compressed and less prone to degradation over time. You don't need to specify anything special to create it:
71
+
72
+
```
73
+
docker run -v /var/run/docker.sock:/var/run/docker.sock \
74
+
-v /host/path/change/me:/output \
75
+
--privileged -t --rm \
76
+
singularityware/docker2singularity:2.4
77
+
ubuntu:14.04
78
+
```
79
+
If you ever need to make changes, you can easily export the squashfs image into either a sandbox folder or ext3 (legacy) image, both of which have writable.
A sandbox image is a folder that is ideal for development. You can view it on your desktop, cd inside and browse, and it works like a Singularity image. To create a sandbox, specify the `-f` flag:
88
+
89
+
```
90
+
docker run -v /var/run/docker.sock:/var/run/docker.sock \
91
+
-v /host/path/change/me:/output \
92
+
--privileged -t --rm \
93
+
singularityware/docker2singularity:2.4 \
94
+
-f \
95
+
ubuntu:14.04
96
+
```
97
+
Importantly, you can use `--writable`, and if needed, you can convert a sandbox folder into a production image:
98
+
99
+
```
100
+
sudo singularity build sandbox/ production.simg
101
+
```
102
+
103
+
## Build a Legacy (ext3) Image
104
+
You can build a legacy ext3 image (with `--writable`) with the `-w` flag. This is an older image format that is more prone to degradation over time, and (building) may not be supported for future versions of the software.
105
+
106
+
```
107
+
docker run -v /var/run/docker.sock:/var/run/docker.sock \
108
+
-v /host/path/change/me:/output \
109
+
--privileged -t --rm \
110
+
singularityware/docker2singularity:2.4 \
111
+
-w \
112
+
ubuntu:14.04
113
+
```
114
+
You can also use `--writable` and convert an ext3 image into a production image:
115
+
116
+
```
117
+
sudo singularity build ext3.img production.simg
118
+
```
119
+
120
+
32
121
## Tips for making Docker images compatible with Singularity
33
122
34
123
- Define all environmental variables using the `ENV` instruction set. Do not rely on `.bashrc`, `.profile`, etc.
@@ -68,5 +157,6 @@ If you are getting `WARNING: Non existant bind point (directory) in container: '
68
157
-m "/shared_fs /custom_mountpoint2" \
69
158
ubuntu:14.04
70
159
160
+
71
161
## Acknowledgements
72
162
This work is heavily based on the `docker2singularity` work done by [vsoch](https://github.com/vsoch) and [gmkurtzer](https://github.com/gmkurtzer). Hopefully most of the conversion code will be merged into Singularity in the future making this container even leaner!
0 commit comments