|
11 | 11 | S.help() |
12 | 12 |
|
13 | 13 | # These are the defaults, which can be specified |
14 | | -S = Singularity(sudo=False,sudopw=None,debug=False) |
| 14 | +S = Singularity(sudo=False,debug=False) |
15 | 15 |
|
16 | | -# Create an image |
17 | | -image = S.create('myimage.img') |
| 16 | +# Note that the "create" and "import" workflow is deprecated in favor of build |
| 17 | +# https://singularityware.github.io/docs-build |
18 | 18 |
|
19 | | -# Import into it |
| 19 | +image = S.build('myimage.simg', 'docker://ubuntu:latest') # requires sudo |
| 20 | + |
| 21 | +# (Deprecated) create an image and import into it |
| 22 | +image = S.create('myimage.simg') |
20 | 23 | S.importcmd(image,'docker://ubuntu:latest') |
21 | 24 |
|
22 | 25 | # Execute command to container |
23 | 26 | result = S.execute(image,command='cat /singularity') |
24 | 27 | print(result) |
25 | 28 | ''' |
26 | | -#!/bin/sh |
27 | | -
|
28 | | -if test -x /bin/bash; then |
29 | | - exec /bin/bash "$@" |
30 | | -elif test -x /bin/sh; then |
31 | | - exec /bin/sh "$@" |
32 | | -else |
33 | | - echo "ERROR: No valid shell within container" |
34 | | - exit 255 |
35 | | -fi |
| 29 | +'#!/bin/sh\n\nexec "/bin/bash"\n' |
36 | 30 | ''' |
37 | 31 |
|
38 | 32 | # For any function you can get the docs: |
39 | 33 | S.help(command="exec") |
40 | 34 |
|
41 | | -# export an image as a byte array |
42 | | -byte_array = S.export(image) |
| 35 | +# export an image to tar |
| 36 | +tar = S.export(image) |
| 37 | + |
| 38 | +# Show apps and inspect |
| 39 | +S.apps(image) |
| 40 | +S.inspect(image) |
43 | 41 |
|
44 | | -# Get an in memory tar |
45 | | -from singularity.reproduce import get_memory_tar |
46 | | -tar = get_memory_tar(image) |
| 42 | +''' |
| 43 | +{ |
| 44 | + "data": { |
| 45 | + "attributes": { |
| 46 | + "deffile": null, |
| 47 | + "help": null, |
| 48 | + "labels": null, |
| 49 | + "environment": "# Custom environment shell code should follow\n\n", |
| 50 | + "runscript": "#!/bin/sh\n\nexec \"/bin/bash\"\n", |
| 51 | + "test": null |
| 52 | + }, |
| 53 | + "type": "container" |
| 54 | + } |
| 55 | +} |
| 56 | +''' |
0 commit comments