Skip to content

Commit 61c7ee4

Browse files
authored
Merge pull request #1235 from cgwalters/more-var-doc
docs/filesystem: Reword /var a bit
2 parents 35c1d5c + f16492c commit 61c7ee4

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

docs/src/filesystem.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,25 @@ undefined behavior. There is a check for this in `bootc container lint`.
115115

116116
Content in `/var` persists by default; it is however supported to make it or subdirectories
117117
mount points (whether network or `tmpfs`). There is exactly one `/var`. If it is
118-
not a distinct partition, then "physically" currently it is a bind mount into
118+
not a distinct partition, then it is automatically made a bind from
119119
`/ostree/deploy/$stateroot/var` and shared across "deployments" (bootloader entries).
120120

121-
As of OSTree v2024.3, by default [content in /var acts like a Docker VOLUME /var](https://github.com/ostreedev/ostree/pull/3166/commits/f81b9fa1666c62a024d5ca0bbe876321f72529c7).
121+
You may include content in `/var` in your image - and reference base images may
122+
have a few basic directories such as `/var/tmp` (in order to ease use in container
123+
builds).
122124

123-
This means that the content from the container image is copied at initial installation time, and *not updated thereafter*.
125+
However, it is very important to understand that content included in `/var`
126+
in the container image acts like a Docker `VOLUME /var`. This means its
127+
contents are unpacked *only from the initial image* - subsequent changes to `/var`
128+
in a container image are not automatically applied.
129+
130+
A common case is for applications to want some directory structure (e.g. `/var/lib/postgresql`) to be pre-created.
131+
It's recommended to use [systemd tmpfiles.d](https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html)
132+
for this. An even better approach where applicable is [StateDirectory=](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory=)
133+
in units.
134+
135+
As of bootc 1.1.6, the `bootc container lint` command will check for missing `tmpfiles.d`
136+
entries and warn.
124137

125138
Note this is very different from the handling of `/etc`. The rationale for this is
126139
that `/etc` is relatively small configuration files, and the expected configuration
@@ -139,11 +152,6 @@ and ready, but only take effect on reboot).
139152
In general, this is the same rationale for Docker `VOLUME`: decouple the application
140153
code from its data.
141154

142-
A common case is for applications to want some directory structure (e.g. `/var/lib/postgresql`) to be pre-created.
143-
It's recommended to use [systemd tmpfiles.d](https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html)
144-
for this. An even better approach where applicable is [StateDirectory=](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory=)
145-
in units.
146-
147155
## Other directories
148156

149157
It is not supported to ship content in `/run` or `/proc` or other [API Filesystems](https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems/) in container images.

0 commit comments

Comments
 (0)