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
--image IMAGE full path to singularity image (for use with --package
43
43
and --tree)
44
-
--images IMAGES images, separated by commas (for use with --simtree)
44
+
--images IMAGES images, separated by commas (for use with --simtree
45
+
and --subtract
45
46
--debug use verbose logging to debug.
46
47
--outfolder OUTFOLDER
47
48
full path to folder for output, stays in tmp (or pwd)
48
49
if not specified
49
50
--package package a singularity container for singularity hub
51
+
--os estimate the operating system of your container.
52
+
--oscalc calculate similarity score for your container vs.
53
+
docker library OS.
54
+
--tags retrieve list of software tags for an image, itself
55
+
minus it's base
50
56
--tree view the guts of an singularity image (use --image)
51
57
--simtree view common guts between two images (use --images)
52
-
--subtract subtract one container image from the second to make
53
-
a difference tree (use --images first,subtract)
58
+
--subtract subtract one container image from the second to make a
59
+
difference tree (use --images first,subtract)
54
60
--simcalc calculate similarity (number) between images based on
55
61
file contents.
56
62
--size SIZE If using Docker or shub image, you can change size
57
63
(default is 1024)
58
64
59
65
60
66
61
-
### Package your container
67
+
### Classify your container
68
+
Singularity python provides functions for quickly assessing the base operating system of your container, retrieving a list of software tags that are relevant when this base is subtracted, and getting similarity scores of your container to a library of base software.
62
69
63
-
A package is a zipped up file that contains the image, the singularity runscript as `runscript`, a `VERSION` file, and a list of files `files.txt` and folders `folders.txt` in the container.
The example package can be [downloaded for inspection](http://www.vbmis.com/bmi/project/singularity/package_image/ubuntu:latest-2016-04-06.img.zip), as can the [image used to create it](http://www.vbmis.com/bmi/project/singularity/package_image/ubuntu:latest-2016-04-06.img). This is one of the drivers underlying [singularity hub](http://www.singularity-hub.org) (under development).
74
+
shub --image docker://python:latest --os
75
+
[sudo] password for vanessa
76
+
Most similar OS found to be debian:7.11
77
+
debian:7.11
68
78
69
-
-**files.txt** and **folders.txt**: are simple text file lists with paths in the container, and this choice is currently done to provide the rawest form of the container contents. These files also are used to generate interactive visualizations, and calculate similarity between containers.
70
-
-**VERSION**: is a text file with one line, an md5 hash generated for the image when it was packaged.
71
-
-**{{image}}.img**: is of course the original singularity container (usually a .img file)
79
+
or to do this from within Python, see the [provided example](examples/classify_image/estimate_os.py). From within python, you can export the sudopw as the environmental variable "pancakes" and it won't need to ask. This is not ideal, but it's required for now since we are using Singularity to export the image. This will likely be changed soon.
72
80
73
-
First, go to where you have some images:
74
81
75
-
ls
76
-
ubuntu.img
77
-
82
+
#### Get software tags
83
+
Singularity Hub uses a simple algorithm to obtain a likely list of software that is important to your image. It assumes that (most) core installed software is in a folder called `bin`, and returns the list of these files with the estimated base image subtracted. You can do this as follows:
78
84
79
-
You can now use the `shub` command line tool to package your image. Note that you must have [singularity installed](https://singularityware.lbl.gov/install-linux), and depending on the function you use, you will likely need to use sudo. We can use the `--package` argument to package our image:
80
85
81
-
shub --image ubuntu.img --package
86
+
shub --image docker://python:latest --tags
87
+
82
88
89
+
We also provide an [example for Python](examples/classify_image/derive_tags.py). If you do this programatically, you can change the folder(s) that are included, meaning that you could get a custom list of software (eg, libraries in `lib`, or python packages in `site-packages`).
83
90
84
-
If no output folder is specified, the resulting image (named in the format `ubuntu.img.zip` will be output in the present working directory. You can also specify an output folder:
If you want to get a complete list of scores for your image against a core set of latest [docker-os](singularity/analysis/packages/docker-os) images:
87
94
88
-
For the package command, you will need to put in your password to grant sudo priviledges, as packaging requires using the singularity `export` functionality.
95
+
shub --image docker://python:latest --oscalc
89
96
90
-
For more details, and a walkthrough with sample data, please see [examples/package_image](examples/package_image)
97
+
98
+
or again see [this example](examples/classify_image/estimate_os.py) for doing this from within python.
91
99
92
100
93
101
### View the inside of a container
@@ -114,6 +122,14 @@ An [interactive demo](https://singularityware.github.io/singularity-python/examp
114
122
115
123
### Visualize Containers
116
124
125
+
#### Container Similarity Clustering
126
+
Do you have sets of containers or packages, and want to cluster them based on similarities?
@@ -146,7 +162,7 @@ An [interactive demo](https://singularityware.github.io/singularity-python/examp
146
162
What files and folders differ between two containers? What does it look like if I subtract one image from the second? `shub` provides a command line tool to generate a visualization to do exactly this.
As with `simtree`, this function supports both docker and singularity images as inputs.
152
168
@@ -159,7 +175,7 @@ An [interactive demo](https://singularityware.github.io/singularity-python/examp
159
175
The same functions above can be used to show the exact similarities (intersect) and differences (files and/or folders unique to two images) between two images. You can get a data structure with this information as follows:
160
176
161
177
162
-
from shub.views import compare_containers
178
+
from singularity.analysis.compare import compare_containers
163
179
164
180
image1 = 'ubuntu.img'
165
181
image2 = 'centos.img'
@@ -168,6 +184,12 @@ The same functions above can be used to show the exact similarities (intersect)
@@ -179,6 +201,38 @@ and the same applies for specification of Docker images, as in the previous exam
179
201
180
202
181
203
204
+
### Package your container
205
+
The driver of much of the above is the simple container package. A package is a zipped up file that contains the image, the singularity runscript as `runscript`, a `VERSION` file, and a list of files `files.txt` and folders `folders.txt` in the container.
The example package can be [downloaded for inspection](http://www.vbmis.com/bmi/project/singularity/package_image/ubuntu:latest-2016-04-06.img.zip), as can the [image used to create it](http://www.vbmis.com/bmi/project/singularity/package_image/ubuntu:latest-2016-04-06.img). This is one of the drivers underlying [singularity hub](http://www.singularity-hub.org) (under development).
210
+
211
+
-**files.txt** and **folders.txt**: are simple text file lists with paths in the container, and this choice is currently done to provide the rawest form of the container contents. These files also are used to generate interactive visualizations, and calculate similarity between containers.
212
+
-**VERSION**: is a text file with one line, an md5 hash generated for the image when it was packaged.
213
+
-**{{image}}.img**: is of course the original singularity container (usually a .img file)
214
+
215
+
First, go to where you have some images:
216
+
217
+
ls
218
+
ubuntu.img
219
+
220
+
221
+
You can now use the `shub` command line tool to package your image. Note that you must have [singularity installed](https://singularityware.lbl.gov/install-linux), and depending on the function you use, you will likely need to use sudo. We can use the `--package` argument to package our image:
222
+
223
+
shub --image ubuntu.img --package
224
+
225
+
226
+
If no output folder is specified, the resulting image (named in the format `ubuntu.img.zip` will be output in the present working directory. You can also specify an output folder:
For the package command, you will need to put in your password to grant sudo priviledges, as packaging requires using the singularity `export` functionality.
231
+
232
+
For more details, and a walkthrough with sample data, please see [examples/package_image](examples/package_image)
0 commit comments