Skip to content

Commit f190c8b

Browse files
authored
Merge pull request #669 from bedroge/container_exec_instead_of_run
use `exec` instead of `run` for `eessi_container.sh`
2 parents 5db81da + f7a2950 commit f190c8b

1 file changed

Lines changed: 57 additions & 43 deletions

File tree

docs/getting_access/eessi_container.md

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ illustrating the use of the script.
1111

1212
- Apptainer 1.0.0 (_or newer_), or Singularity 3.7.x
1313
- Check with `apptainer --version` or `singularity --version`
14-
- Support for the `--fusemount` option in the ``shell`` and ``run`` subcommands is required
14+
- Support for the `--fusemount` option in the ``shell`` and ``exec`` subcommands is required
1515
- Git
1616
- Check with `git --version`
1717

@@ -69,41 +69,55 @@ You should see the following output
6969
```
7070
usage: ./eessi_container.sh [OPTIONS] [[--] SCRIPT or COMMAND]
7171
OPTIONS:
72-
-a | --access {ro,rw} - ro (read-only), rw (read & write) [default: ro]
73-
-c | --container IMG - image file or URL defining the container to use
74-
[default: docker://ghcr.io/eessi/build-node:debian11]
75-
-g | --storage DIR - directory space on host machine (used for
76-
temporary data) [default: 1. TMPDIR, 2. /tmp]
77-
-h | --help - display this usage information [default: false]
78-
-i | --host-injections - directory to link to for host_injections
79-
[default: /..storage../opt-eessi]
80-
-l | --list-repos - list available repository identifiers [default: false]
81-
-m | --mode MODE - with MODE==shell (launch interactive shell) or
82-
MODE==run (run a script or command) [default: shell]
83-
-n | --nvidia MODE - configure the container to work with NVIDIA GPUs,
84-
MODE==install for a CUDA installation, MODE==run to
85-
attach a GPU, MODE==all for both [default: false]
86-
-r | --repository CFG - configuration file or identifier defining the
87-
repository to use [default: EESSI via
88-
container configuration]
89-
-u | --resume DIR/TGZ - resume a previous run from a directory or tarball,
90-
where DIR points to a previously used tmp directory
91-
(check for output 'Using DIR as tmp ...' of a previous
92-
run) and TGZ is the path to a tarball which is
93-
unpacked the tmp dir stored on the local storage space
94-
(see option --storage above) [default: not set]
95-
-s | --save DIR/TGZ - save contents of tmp directory to a tarball in
96-
directory DIR or provided with the fixed full path TGZ
97-
when a directory is provided, the format of the
98-
tarball's name will be {REPO_ID}-{TIMESTAMP}.tgz
99-
[default: not set]
100-
-v | --verbose - display more information [default: false]
101-
-x | --http-proxy URL - provides URL for the env variable http_proxy
102-
[default: not set]; uses env var $http_proxy if set
103-
-y | --https-proxy URL - provides URL for the env variable https_proxy
104-
[default: not set]; uses env var $https_proxy if set
105-
106-
If value for --mode is 'run', the SCRIPT/COMMAND provided is executed. If
72+
-a | --access {ro,rw} - sets access globally for all CVMFS repositories:
73+
ro (read-only), rw (read & write) [default: ro]
74+
-b | --extra-bind-paths - specify extra paths to be bound into the container.
75+
To specify multiple bind paths, separate by comma.
76+
Example: '/src:/dest:ro,/src2:/dest2:rw'
77+
-c | --container IMG - image file or URL defining the container to use
78+
[default: docker://ghcr.io/eessi/build-node:debian12]
79+
-f | --fakeroot - run the container with --fakeroot [default: false]
80+
-g | --storage DIR - directory space on host machine (used for
81+
temporary data) [default: 1. TMPDIR, 2. /tmp]
82+
-h | --help - display this usage information [default: false]
83+
-i | --host-injections - directory to link to for host_injections
84+
[default: /..storage../opt-eessi]
85+
-l | --list-repos - list available repository identifiers [default: false]
86+
-m | --mode MODE - with MODE==shell (launch interactive shell) or
87+
MODE==exec/run (run a script or command) [default: shell]
88+
-n | --nvidia MODE - configure the container to work with NVIDIA GPUs,
89+
MODE==install for a CUDA installation, MODE==run to
90+
attach a GPU, MODE==all for both [default: false]
91+
-o | --overlay-tool ARG - tool to use to create (read-only or writable) overlay;
92+
selected tool *must* be available in container image being used;
93+
can be 'fuse-overlayfs' or 'unionfs' [default: unionfs]
94+
-p | --pass-through ARG - argument to pass through to the launch of the
95+
container; can be given multiple times [default: not set]
96+
-r | --repository CFG - configuration file or identifier defining the
97+
repository to use; can be given multiple times;
98+
CFG may include suffixes ',access={ro,rw},mode={bind,fuse}' to
99+
overwrite the global access and/or mount mode for this repository;
100+
use 'None' to not mount any repositories
101+
[default: software.eessi.io via CVMFS config available
102+
via default container, see --container]
103+
-u | --resume DIR/TGZ - resume a previous run from a directory or tarball,
104+
where DIR points to a previously used tmp directory
105+
(check for output 'Using DIR as tmp ...' of a previous
106+
run) and TGZ is the path to a tarball which is
107+
unpacked the tmp dir stored on the local storage space
108+
(see option --storage above) [default: not set]
109+
-s | --save DIR/TGZ - save contents of tmp directory to a tarball in
110+
directory DIR or provided with the fixed full path TGZ
111+
when a directory is provided, the format of the
112+
tarball's name will be {REPO_ID}-{TIMESTAMP}.tgz
113+
[default: not set]
114+
-v | --verbose - display more information [default: false]
115+
-x | --http-proxy URL - provides URL for the env variable http_proxy
116+
[default: not set]; uses env var $http_proxy if set
117+
-y | --https-proxy URL - provides URL for the env variable https_proxy
118+
[default: not set]; uses env var $https_proxy if set
119+
120+
If value for --mode is 'exec' or 'run', the SCRIPT/COMMAND provided is executed. If
107121
arguments to the script/command start with '-' or '--', use the flag terminator
108122
'--' to let eessi_container.sh stop parsing arguments.
109123
```
@@ -158,7 +172,7 @@ Let's "`ls /cvmfs/software.eessi.io`" through the `eessi_container.sh` script
158172
to check if the CernVM-FS EESSI repository is accessible:
159173

160174
``` { .bash .copy }
161-
./eessi_container.sh --mode run ls /cvmfs/software.eessi.io
175+
./eessi_container.sh --mode exec ls /cvmfs/software.eessi.io
162176
```
163177

164178
You should see an output such as
@@ -177,7 +191,7 @@ Note that this time no interactive shell session is started in the container:
177191
only the provided command is run in the container, and when that finishes
178192
you are back in the shell session where you ran the `eessi_container.sh` script.
179193

180-
This is because we used the `--mode run` command line option.
194+
This is because we used the `--mode exec` command line option.
181195

182196
!!! Note
183197
The last line in the output is the output of the `ls` command,
@@ -194,7 +208,7 @@ CMD="ls -l /cvmfs/software.eessi.io"
194208
```
195209

196210
!!! Note
197-
We changed the mode from `run` to `shell` because we use a different method
211+
We changed the mode from `exec` to `shell` because we use a different method
198212
to let the script run _our_ command, by feeding it in via the `stdin` input channel using `<<<`.
199213

200214
Because `shell` is the default value for `--mode` we can also omit this and
@@ -289,7 +303,7 @@ linux/x86_64/intel/skylake_avx512
289303
```
290304
Lines 7 to 20 show the output of the script `eessi_architectures.sh`.
291305

292-
If you want to use the mode `run`, you have to make the script's location
306+
If you want to use the mode `exec`, you have to make the script's location
293307
available inside the container.
294308

295309
This can be done by mapping the current directory (`${PWD}`),
@@ -299,13 +313,13 @@ inside the container using the `$SINGULARITY_BIND` or
299313

300314
For example:
301315
``` { .bash .copy }
302-
SINGULARITY_BIND=${PWD}:/scripts ./eessi_container.sh --mode run /scripts/eessi_architectures.sh
316+
SINGULARITY_BIND=${PWD}:/scripts ./eessi_container.sh --mode exec /scripts/eessi_architectures.sh
303317
```
304318
## Running scripts or commands with parameters starting with `-` or `--`
305319
Let's assume we would like to get more information about the entries of
306320
`/cvmfs/software.eessi.io`. If we would just run
307321
``` { .bash .copy }
308-
./eessi_container.sh --mode run ls -lH /cvmfs/software.eessi.io
322+
./eessi_container.sh --mode exec ls -lH /cvmfs/software.eessi.io
309323
```
310324
we would get an error message such as
311325
``` { .bash .no-copy }
@@ -335,7 +349,7 @@ We can resolve this in two ways:
335349
2. Using the flag terminator `--` which tells `eessi_container.sh` to stop
336350
parsing command line arguments. For example,
337351
``` { .bash .copy }
338-
./eessi_container.sh --mode run -- ls -lH /cvmfs/software.eessi.io
352+
./eessi_container.sh --mode exec -- ls -lH /cvmfs/software.eessi.io
339353
```
340354
which should result in the output similar to
341355
``` { .yaml .no-copy }

0 commit comments

Comments
 (0)