File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ # Download a Singularity Hub Container
2+
3+ # This is a simple script to use the singularity command line tool to
4+ # obtain a manifest and download an image
5+
6+ from singularity .hub .client import Client
7+
8+ shub = Client () # Singularity Hub Client
9+
10+
11+ #############################################
12+ # Task 1: Download a container
13+ #############################################
14+
15+
16+ container_name = 'vsoch/singularity-hello-world'
17+ collection = shub .get_collection (container_name )
18+ container_ids = collection ['container_set' ]
19+
20+ # Here is one we are interested in
21+ container_id = container_ids .pop ()
22+
23+ # The container manifest has all information about container
24+ manifest = shub .get_container (container_id )
25+
26+ # Default will download to present working directory,
27+ # but we can also set download_folder to something:
28+ image = shub .pull_container (manifest )
29+
30+ # You can also set the download_folder or name, eg:
31+ image = shub .pull_container (manifest ,
32+ download_folder = '/tmp' ,
33+ name = 'container.img.gz' )
You can’t perform that action at this time.
0 commit comments