Skip to content

Commit 9f0928f

Browse files
committed
Divide container doc
1 parent 9bf2d9f commit 9f0928f

File tree

6 files changed

+892
-890
lines changed

6 files changed

+892
-890
lines changed

docs/software/container-engine.md

Lines changed: 0 additions & 889 deletions
This file was deleted.
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
[](){#ref-ce-edf-reference}
2+
## EDF Reference
3+
4+
EDF files use the [TOML format](https://toml.io/en/). For details about the data types used by the different parameters, please refer to the [TOML spec webpage](https://toml.io/en/v1.0.0).
5+
6+
In the following, the default value is none (i.e., the empty value of the corresponding type) if not specified.
7+
8+
### (ARRAY or STRING) base_environment
9+
10+
Ordered list of EDFs that this file inherits from. Parameters from listed environments are evaluated sequentially. Supports up to 10 levels of recursion.
11+
12+
??? note
13+
* Parameters from the listed environments are evaluated sequentially, adding new entries or overwriting previous ones, before evaluating the parameters from the current EDF. In other words, the current EDF inherits the parameters from the EDFs listed in `base_environment`. When evaluating `mounts` or `env` parameters, values from downstream EDFs are appended to inherited values.
14+
* The individual EDF entries in the array follow the same search rules as the arguments of the `--environment` CLI option for Slurm; they can be either file paths or filenames without extension if the file is located in the [EDF search path][ref-ce-edf-search-path].
15+
* This parameter can be a string if there is only one base environment.
16+
17+
??? example
18+
* Single environment inheritance:
19+
```bash
20+
base_environment = "common_env"
21+
```
22+
23+
* Multiple environment inheritance:
24+
```bash
25+
base_environment = ["common_env", "ml_pytorch_env1"]
26+
```
27+
28+
### (STRING) image
29+
30+
The container image to use. Can reference a remote Docker/OCI registry or a local Squashfs file as a filesystem path.
31+
32+
??? note
33+
* The full format for remote references is `[USER@][REGISTRY#]IMAGE[:TAG]`.
34+
* `[REGISTRY#]`: (optional) registry URL, followed by #. Default: Docker Hub.
35+
* `IMAGE`: image name.
36+
* `[:TAG]`: (optional) image tag name, preceded by :.
37+
* The registry user can also be specified in the `$HOME/.config/enroot/.credentials` file.
38+
39+
??? example
40+
* Reference of Ubuntu image in the Docker Hub registry (default registry)
41+
```bash
42+
image = "library/ubuntu:24.04"
43+
```
44+
45+
* Explicit reference of Ubuntu image in the Docker Hub registry
46+
```bash
47+
image = "docker.io#library/ubuntu:24.04"
48+
```
49+
50+
* Reference to PyTorch image from NVIDIA Container Registry (nvcr.io)
51+
```bash
52+
image = "nvcr.io#nvidia/pytorch:22.12-py3"
53+
```
54+
55+
* Image from third-party quay.io registry
56+
```bash
57+
image = "quay.io#madeeks/osu-mb:6.2-mpich4.1-ubuntu22.04-arm64"
58+
```
59+
60+
* Reference to a manually pulled image stored in parallel FS
61+
```bash
62+
image = "/path/to/image.squashfs"
63+
```
64+
65+
### (STRING) workdir
66+
67+
Initial working directory when the container starts. Default: inherited from image.
68+
69+
??? example
70+
* Workdir pointing to a user defined project path 
71+
```bash
72+
workdir = "/home/user/projects"
73+
```
74+
* Workdir pointing to the `/tmp` directory
75+
```bash
76+
workdir = "/tmp"
77+
```
78+
79+
### (BOOL) entrypoint
80+
81+
If true, run the entrypoint from the container image. Default: true.
82+
83+
??? example
84+
```bash
85+
entrypoint = false
86+
```
87+
88+
### (BOOL) writable
89+
90+
If false, the container filesystem is read-only. Default: false.
91+
92+
??? example
93+
```bash
94+
writable = true
95+
```
96+
97+
### (ARRAY) mounts
98+
99+
List of bind mounts in the format `SOURCE:DESTINATION[:FLAGS]`. Flags are optional and can include `ro`, `private`, etc.
100+
101+
??? note
102+
* Mount flags are separated with a plus symbol, for example: `ro+private`.
103+
* Optional flags from docker format or OCI (need reference)
104+
105+
??? example
106+
107+
* Literal fixed mount map
108+
```bash
109+
mounts = ["/capstor/scratch/cscs/amadonna:/capstor/scratch/cscs/amadonna"]
110+
```
111+
112+
* Mapping path with `env` variable expansion
113+
```bash
114+
mounts = ["/capstor/scratch/cscs/${USER}:/capstor/scratch/cscs/${USER}"]
115+
```
116+
117+
* Mounting the scratch filesystem using a host environment variable
118+
```bash
119+
mounts = ["${SCRATCH}:/scratch"]
120+
```
121+
122+
123+
### (TABLE) env
124+
125+
Environment variables to set in the container. Null-string values will unset the variable. Default: inherited from the host and the image.
126+
127+
??? note
128+
* By default, containers inherit environment variables from the container image and the host environment, with variables from the image taking precedence.
129+
* The env table can be used to further customize the container environment by setting, modifying, or unsetting variables.
130+
* Values of the table entries must be strings. If an entry has a null value, the variable corresponding to the entry key is unset in the container.
131+
132+
133+
??? example
134+
135+
* Basic `env` block
136+
```bash
137+
[env]
138+
MY_RUN = "production",
139+
DEBUG = "false"
140+
```
141+
142+
* Use of environment variable expansion
143+
```bash
144+
[env]
145+
MY_NODE = "${VAR_FROM_HOST}",
146+
PATH = "${PATH}:/custom/bin",
147+
DEBUG = "true"
148+
```
149+
150+
151+
### (TABLE) annotations
152+
153+
OCI-like annotations for the container. For more details, refer to the [Annotations][ref-ce-annotations] section.
154+
155+
??? example
156+
157+
* Disabling the CXI hook
158+
```bash
159+
[annotations]
160+
com.hooks.cxi.enabled = "false"
161+
```
162+
163+
* Control of SSH hook parameters via annotation and variable expansion
164+
```bash
165+
[annotations.com.hooks.ssh]
166+
authorize_ssh_key = "/capstor/scratch/cscs/${USER}/tests/edf/authorized_keys"
167+
enabled = "true"
168+
```
169+
170+
* Alternative example for usage of annotation with fixed path
171+
```bash
172+
[annotations]
173+
com.hooks.ssh.authorize_ssh_key = "/path/to/authorized_keys"
174+
com.hooks.ssh.enabled = "true"
175+
```
176+
177+
!!! note
178+
Environment variable expansion and relative paths expansion are only available on the Bristen vCluster as technical preview.
179+
180+
### Environment Variable Expansion
181+
182+
Environment variable expansion allows for dynamic substitution of environment variable values within the EDF (Environment Definition File). This capability applies across all configuration parameters in the EDF, providing flexibility in defining container environments.
183+
184+
* *Syntax*. Use ${VAR} to reference an environment variable VAR. The variable's value is resolved from the combined environment, which includes variables defined in the host and the container image, the later taking precedence.
185+
* *Scope*. Variable expansion is supported across all EDF parameters. This includes EDF’s parameters like mounts, workdir, image, etc. For example, ${SCRATCH} can be used in mounts to reference a directory path.
186+
* *Undefined Variables*. Referencing an undefined variable results in an error. To safely handle undefined variables, you can use the syntax ${VAR:-}, which evaluates to an empty string if VAR is undefined.
187+
* *Preventing Expansion*. To prevent expansion, use double dollar signs $$. For example, $$${VAR} will render as the literal string ${VAR}.
188+
* *Limitations*
189+
* Variables defined within the [env] EDF table cannot reference other entries from [env] tables in the same or other EDF files (e.g. the ones entered as base environments) . Therefore, only environment variables from the host or image can be referenced.
190+
* *Environment Variable Resolution Order*. The environment variables are resolved based on the following order:
191+
* TOML env: Variable values as defined in EDF’s env.
192+
* Container Image: Variables defined in the container image's environment take precedence.
193+
* Host Environment: Environment variables defined in the host system.
194+
195+
### Relative paths expansion
196+
197+
Relative filesystem paths can be used within EDF parameters, and will be expanded by the CE at runtime. The paths are interpreted as relative to the working directory of the process calling the CE, not to the location of the EDF file.

0 commit comments

Comments
 (0)