|
1 | 1 | # docker2singularity |
2 | 2 |
|
3 | | -You have several options for converting docker images to singularity. |
| 3 | +These are no longer the recommended way/standard to get a Docker image into Singularity, but are provided for |
| 4 | +reference if they might be useful to you. These methods rely upon having the Docker daemon installed, and the command line tool uses the native registry (meaning you don't need Docker). For the recommended way, see [http://singularity.lbl.gov/docs-docker](http://singularity.lbl.gov/docs-docker). |
4 | 5 |
|
5 | | -## shub command line |
6 | | -This tool currently has command line and (functions) to convert a Docker image to Singularity. Currently, we don't add any sort of runscript from the CMD, as this needs to be better developed. To use on the command line: |
7 | 6 |
|
| 7 | +## docker2singularity.py |
| 8 | +This python script has functions that could be used toward this goal. You could do: |
8 | 9 |
|
9 | | - shub --docker2singularity ubuntu:latest |
| 10 | + cd examples/docker2singularity |
| 11 | + from docker2singularity import * |
| 12 | + docker_image = 'ubuntu:latest' |
| 13 | + image = docker2singularity(docker_image,output_folder=None) |
10 | 14 |
|
11 | | - |
12 | | -will export the image `ubuntu:latest-2016-04-06.img` into your current working directory. If you want to export to a different folder: |
13 | 15 |
|
14 | | - |
15 | | - shub --docker2singularity ubuntu:latest --outfolder /home/vanessa/Desktop |
| 16 | +This example will export the image `ubuntu:latest-2016-04-06.img` into your current working directory. If you want to export to a different folder, set the output_folder to something else. |
16 | 17 |
|
17 | 18 |
|
18 | 19 | ## docker2singularity bash |
19 | 20 | Using the script in this folder, you can run: |
20 | 21 |
|
21 | 22 | docker2singularity.sh ubuntu:14.04 |
22 | | - |
23 | | - |
24 | | -## singularity bash |
25 | | -You can also use the singularity (bash) command line tool, which requires you to specify the --file location of your Docker image. This method is not ideal because most people don't know where these images are on their computer! |
26 | | - |
27 | | - |
28 | | - sudo singularity create /tmp/fedora.img |
29 | | - sudo singularity import -t docker fedora /tmp/fedora.img |
30 | | - |
31 | | - |
32 | | -## singularity-python |
33 | | -You can finally use this command line tool to create an image in the same manner as the above script. |
34 | | - |
35 | | - from singularity.cli import Singularity |
36 | | - S = Singularity() |
37 | | - docker_image = S.docker2singularity("ubuntu:latest") |
0 commit comments