Mount config files and dirs¶
Containers have two ways to get files bind-mounted into them from the spec:
configFilesmount single files. Changing one restarts the container.configDirsmount a directory whose content is swapped atomically. Changing it reloads the container in place, without a restart.
Use configDirs when the service can reload its config on a signal (nginx, most reverse proxies, many daemons via SIGHUP), and configFiles otherwise.
Mount single files¶
| Text Only | |
|---|---|
Each entry is written to /etc/containers/config/webapp/ on the host and injected into the quadlet as a read-only bind mount at mountPath.
mode is optional and defaults to 0644.
A changed content is a new file on disk, and a static bind mount only picks it up when the container is recreated, so syslet restarts the container as part of the apply.
Reload config without a restart¶
| Text Only | |
|---|---|
A configDir's files are written into a new versioned subdirectory, and a stable current symlink is atomically repointed at it.
The container bind-mounts the symlink path, so it sees the new files at once and never a partially-written directory.
The mount path must end in a real, bind-mountable directory.
[Service] ExecReload= is required: it tells the running container to reload its config, here by sending nginx a SIGHUP.
syslet's validation rejects a spec with configDirs and no ExecReload=, since without it there is no way to trigger a reload.
What each change does:
- Only a
configDir's file content changed: syslet swaps the symlink and runsExecReload=throughsystemctl reload webapp.service. The container keeps running. - A
configDirsentry added or removed, or any change to the container's own unit options: the usual stop and start, as for any other container change (see Service actions).