1
- # Intro to Containers (Under Construction)
1
+ # Intro to Containers
2
2
3
3
<br >
4
4
14
14
* [ Build from Docker registry] ( #build-from-docker-registry )
15
15
16
16
17
- <h3 style =" color :#FBFCFC ; background-color :#34495E ;" > <a href =" #build-remotely-using-sylabs " style =" text-decoration =none ; color :#FBFCFC ;" > Build remotely using Sylabs </a > </h3 >
18
17
19
18
* [ Logging In] ( #logging-in )
20
19
* [ Working on the Command Line] ( #working-on-the-command-line )
24
23
<br ><br ><br ><br ><br ><br ><br ><br ><br ><br ><br ><br >
25
24
26
25
27
- # Singularity
26
+ # Apptainer
28
27
29
- > Note: look in .singularity for working files
28
+ > Note: look in .Apptainer for working files
30
29
31
30
``` console
32
31
[laptop ~]$ ssh netid@hpc.arizona.edu
33
32
[netid@gatekeeper ~] $ shell
34
33
(puma) [netid@wentletrap ~] $ ocelote
35
34
(ocelote) [netid@wentletrap ~] $ interactive
36
- [netid@i16n2 ~] $ singularity help
37
- [netid@i16n2 ~] $ singularity help build
35
+ [netid@i16n2 ~] $ Apptainer help
36
+ [netid@i16n2 ~] $ Apptainer help build
38
37
```
39
38
40
39
## Creating a Container
41
40
42
41
### Pull from Docker registry
43
42
> Less reproducible -- image can change
44
43
``` console
45
- [netid@i16n2 ~] $ singularity pull docker://godlovedc/lolcow
44
+ Apptainer pull docker://godlovedc/lolcow
46
45
```
47
46
48
47
### Pull from container library
49
48
> More reproducible
50
49
``` console
51
- [netid@i16n2 ~] $ singularity pull library://sylabsed/examples/lolcow
50
+ Apptainer pull library://sylabsed/examples/lolcow
52
51
```
53
52
54
53
### Build from Docker registry
55
54
> More options, converts to latest format, & needs a name
56
55
``` console
57
- [netid@i16n2 ~] $ singularity build lolcow.sif docker://godlovedc/lolcow
56
+ Apptainer build lolcow.sif docker://godlovedc/lolcow
58
57
```
59
58
60
- ## Build remotely using Sylabs
61
- ### Steps:
62
59
63
- 1 . Log into [ https://cloud.sylabs.io ] ( https://cloud.sylabs.io )
64
- 2 . Generate an access token (API key)
65
- 3 . Start an interactive session:
66
- ``` console
67
- [netid@i16n2 ~] $ singularity remote login
68
- [netid@i16n2 ~] $ singularity build --remote nersc.sif nersc.recipe
69
- [netid@i16n2 ~] $ singularity run nersc.sif
70
- ```
71
-
72
- # Running Singularity on HPC
60
+ ## Running Apptainer on HPC
73
61
74
62
``` console
75
- [netid@i16n2 ~] $ singularity shell lolcow_latest.sif
76
- Singularity >
77
- Singularity > exit
63
+ [netid@i16n2 ~] $ Apptainer shell lolcow_latest.sif
64
+ Apptainer >
65
+ Apptainer > exit
78
66
```
79
67
80
68
``` console
81
- [netid@i16n2 ~] $ singularity run lolcow_latest.sif
69
+ [netid@i16n2 ~] $ Apptainer run lolcow_latest.sif
82
70
[netid@i16n2 ~] $ # Or
83
71
[netid@i16n2 ~] $ ./lolcow_latest.sif
84
72
```
85
73
86
74
``` console
87
- [netid@i16n2 ~] $ singularity run library://sylabsed/examples/lolcow
75
+ [netid@i16n2 ~] $ Apptainer run library://sylabsed/examples/lolcow
88
76
INFO: Using cached image
89
77
_______________________________________
90
78
/ Wrinkles should merely indicate where \
@@ -99,7 +87,7 @@ INFO: Using cached image
99
87
|| ||
100
88
```
101
89
102
- # Singularity on HPC - Running Batch
90
+ # Apptainer on HPC - Running Batch
103
91
``` sh
104
92
#! /bin/bash
105
93
# SBATCH --job-name=lolcow
@@ -112,19 +100,19 @@ INFO: Using cached image
112
100
113
101
114
102
cd /path/to/container
115
- singularity run lolcow_latest.sif
103
+ Apptainer run lolcow_latest.sif
116
104
```
117
105
118
- # Singularity on HPC - Creating and Running
106
+ # Apptainer on HPC - Creating and Running
119
107
This example does not run cleanly, demonstrating that the container needs compatibility with the kernel on the compute node.
120
108
121
- 1 . Copy the ``` TFlow_example.py ``` file from ``` /contrib/singularity /nvidia ```
109
+ 1 . Copy the ``` TFlow_example.py ``` file from ``` /contrib/Apptainer /nvidia ```
122
110
``` console
123
- [netid@i16n8 ~] $ cp /contrib/singularity /nvidia/TFlow_example.py ./
111
+ [netid@i16n8 ~] $ cp /contrib/Apptainer /nvidia/TFlow_example.py ./
124
112
```
125
113
126
114
```
127
- [netid@i16n8 ~]$ singularity exec docker://tensorflow/tensorflow python -m TFlow_example.py
115
+ [netid@i16n8 ~]$ Apptainer exec docker://tensorflow/tensorflow python -m TFlow_example.py
128
116
INFO: Converting OCI blobs to SIF format
129
117
INFO: Starting build...
130
118
Getting image source signatures
@@ -156,26 +144,26 @@ step: 1000, loss: 0.082219, W: 0.292872, b: 0.506447
156
144
[netid@i16n8 ~]$
157
145
```
158
146
159
- # Singularity on HPC - File Paths
147
+ # Apptainer on HPC - File Paths
160
148
Access to your files outside the container: Binding
161
149
You automatically get ``` /home ``` , ``` /tmp ``` , ``` /xdisk ``` , ``` /groups ``` , and ``` $PWD ```
162
150
``` console
163
151
[netid@i16n8 ~] $ echo " Hello from inside the container" > $HOME /hostfile.txt
164
- [netid@i16n8 ~] $ singularity exec lolcow_latest.sif cat $HOME /hostfile.txt
152
+ [netid@i16n8 ~] $ Apptainer exec lolcow_latest.sif cat $HOME /hostfile.txt
165
153
Hello from inside the container
166
154
```
167
155
168
156
``` console
169
157
[netid@i16n8 ~] $ echo " Drink milk (and never eat hamburgers)." > data/cow_advice.txt
170
- [netid@i16n8 ~] $ singularity exec --bind $PWD /data:/mnt lolcow_latest.sif cat /mnt/cow_advice.txt
158
+ [netid@i16n8 ~] $ Apptainer exec --bind $PWD /data:/mnt lolcow_latest.sif cat /mnt/cow_advice.txt
171
159
Drink milk (and never eat hamburgers).
172
160
```
173
161
Alternatives:
174
162
``` console
175
- $ singularity shell --bind /data my-container.sif
163
+ $ Apptainer shell --bind /data my-container.sif
176
164
```
177
165
``` console
178
- $ export SINGULARITY_BINDPATH =/data
166
+ $ export Apptainer_BINDPATH =/data
179
167
```
180
168
181
169
# GPUs and Containers
@@ -190,7 +178,7 @@ We show four ways to run tensorflow containers on HPC. We just use Tensorflow as
190
178
| ----------| ---- |
191
179
| UA HPC Containers Documentation | https://public.confluence.arizona.edu/display/UAHPC/Containers |
192
180
| UA HPC Examples Github | https://ua-researchcomputing-hpc.github.io |
193
- | NIH Containers Documentation | https://hpc.nih.gov/apps/singularity .html |
181
+ | NIH Containers Documentation | https://hpc.nih.gov/apps/Apptainer .html |
194
182
| Sylabs User Guide | https://sylabs.io/guides/3.5/user-guide/introduction.html |
195
183
| Sylabs Examples | https://github.com/sylabs/examples |
196
184
| TACC Container Basics | https://containers-at-tacc.readthedocs.io/en/latest/ |
0 commit comments