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
Copy file name to clipboardExpand all lines: docs/yaml.md
+99-8Lines changed: 99 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,17 @@ For private registries or private repositories on a registry credentials provide
18
18
19
19
## Sections
20
20
21
-
The configuration file is processed in the order `kernel`, `init`, `onboot`, `onshutdown`,
22
-
`services`, `files`, `volumes`. Each section adds files to the root file system. Sections may be omitted.
21
+
The configuration file is processed in the order:
22
+
23
+
1.`kernel`
24
+
1.`init`
25
+
1.`volumes`
26
+
1.`onboot`
27
+
1.`onshutdown`
28
+
1.`services`
29
+
1.`files`
30
+
31
+
Each section adds files to the root file system. Sections may be omitted.
23
32
24
33
Each container that is specified is allocated a unique `uid` and `gid` that it may use if it
25
34
wishes to run as an isolated user (or user namespace). Anywhere you specify a `uid` or `gid`
@@ -100,8 +109,13 @@ including those in `services`, `onboot` and `onshutdown`. The volumes are create
100
109
chosen by linuxkit at build-time. The volumes then can be referenced by other containers and
101
110
mounted into them.
102
111
103
-
Volumes normally are blank directories. If an image is provided, the contents of that image
104
-
will be used to populate the volume.
112
+
Volumes can be in one of several formats:
113
+
114
+
* Blank directory: This is the default, and is an empty directory that is created at build-time. It is an overlayfs mount, and can be shared among multiple containers.
115
+
* Image laid out as filesystem: The contents of the image are used to populate the volume. Default format when an image is provided.
116
+
* Image as OCI v1-layout: The image is used as an [OCI v1-layout](https://github.com/opencontainers/image-spec/blob/main/image-layout.md). Indicated by `format: oci`.
117
+
118
+
Examples of each are given later in this section.
105
119
106
120
The `volumes` section can declare a volume to be read-write or read-only. If the volume is read-write,
107
121
a volume that is mounted into a container can be mounted read-only or read-write. If the volume is read-only,
@@ -111,7 +125,36 @@ By default, volumes are created read-write, and are mounted read-write.
111
125
Volume names **must** be unique, and must contain only lower-case alphanumeric characters, hyphens, and
112
126
underscores.
113
127
114
-
Sample `volumes` section:
128
+
#### Samples of `volumes`
129
+
130
+
##### Empty directory
131
+
132
+
Yaml showing both read-only and read-write:
133
+
134
+
```yml
135
+
volumes:
136
+
- name: dira
137
+
readonly: true
138
+
- name: dirb
139
+
readonly: true
140
+
```
141
+
142
+
Contents:
143
+
144
+
```sh
145
+
$ cd dir && ls -la
146
+
drwxr-xr-x 19 root wheel 608 Sep 30 15:03 .
147
+
drwxrwxrwt 130 root wheel 4160 Sep 30 15:03 ..
148
+
```
149
+
150
+
In the above example:
151
+
152
+
*`dira` is empty and is read-only.
153
+
*`volb` is empty and is read-write.
154
+
155
+
##### Image directory
156
+
157
+
Yaml showing both read-only and read-write:
115
158
116
159
```yml
117
160
volumes:
@@ -120,16 +163,64 @@ volumes:
120
163
readonly: true
121
164
- name: volb
122
165
image: alpine:latest
123
-
readonly: false
124
-
- name: volc
166
+
format: filesystem # optional, as this is the default format
125
167
readonly: false
126
168
```
127
169
128
170
In the above example:
129
171
130
172
* `vola` is populated by the contents of `alpine:latest` and is read-only.
131
173
* `volb` is populated by the contents of `alpine:latest` and is read-write.
132
-
* `volc` is an empty volume and is read-write.
174
+
175
+
Contents:
176
+
177
+
```sh
178
+
$ cd dir && ls -la
179
+
drwxr-xr-x 19 root wheel 608 Sep 30 15:03 .
180
+
drwxrwxrwt 130 root wheel 4160 Sep 30 15:03 ..
181
+
drwxr-xr-x 84 root wheel 2688 Sep 6 14:34 bin
182
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 dev
183
+
drwxr-xr-x 37 root wheel 1184 Sep 6 14:34 etc
184
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 home
185
+
drwxr-xr-x 13 root wheel 416 Sep 6 14:34 lib
186
+
drwxr-xr-x 5 root wheel 160 Sep 6 14:34 media
187
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 mnt
188
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 opt
189
+
dr-xr-xr-x 2 root wheel 64 Sep 6 14:34 proc
190
+
drwx------ 2 root wheel 64 Sep 6 14:34 root
191
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 run
192
+
drwxr-xr-x 63 root wheel 2016 Sep 6 14:34 sbin
193
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 srv
194
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 sys
195
+
drwxr-xr-x 2 root wheel 64 Sep 6 14:34 tmp
196
+
drwxr-xr-x 7 root wheel 224 Sep 6 14:34 usr
197
+
drwxr-xr-x 13 root wheel 416 Sep 6 14:34 var
198
+
```
199
+
200
+
##### Image OCI Layout
201
+
202
+
Yaml showing both read-only and read-write, and both all architectures and a limited subset:
203
+
204
+
```yml
205
+
volumes:
206
+
- name: volo
207
+
image: alpine:latest
208
+
format: oci
209
+
readonly: true
210
+
- name: volp
211
+
image: alpine:latest
212
+
readonly: false
213
+
format: oci
214
+
platforms:
215
+
- linux/amd64
216
+
```
217
+
218
+
In the above example:
219
+
220
+
* `volo` is populated by the contents of `alpine:latest` as an OCI v1-layout for all architectures and is read-only.
221
+
* `volb` is populated by the contents of `alpine:latest` as an OCI v1-layout just for linux/amd64 and is read-write.
0 commit comments