-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Hello, I am trying to configure my home server so that each service runs under its own Linux user inside a Podman container. To maximize my drives' longevity, I want to put the graphroot in a tmpfs (/run/user/$UID/graphroot) and the imagestore in the home dir of the user (so that I don't need to pull all the images at every reboot), important data being stored in bind mounts elsewhere. Indeed some services I run keep writing unimportant data all day long, unnecessarily wearing the drives.
Ideally, I would have /etc/containers/storage.conf specify all of this in a generic fashion, for instance (this is what I would like to do, not an actual working config):
[storage]
driver = "overlay"
graphroot = "/run/user/$UID/graphroot"
imagestore = "$HOME/imagestoreHowever this applies mainly to the root user (only the driver parameter is used by rootless Podman here). There is a rootless_storage_path option to set a generic graphroot path for rootless users system-wide, in which I could write /run/user/$UID/graphroot, but a similar option does not seem to exist for imagestore.
Since this option does not exist, I would have to write imagestore = "$HOME/imagestore" in $HOME/.config/containers/storage.conf for every single user. However, the mere existence of this file makes rootless Podman ignore /etc/containers/storage.conf, which means I have to repeat graphroot and driver in $HOME/.config/containers/storage.conf for every single user too.
There is a last hurdle: I can't just write imagestore = "$HOME/imagestore" in $HOME/.config/containers/storage.conf because this field does not support environment variable substitution (whereas graphroot does). That means I must write imagestore = /home/username/imagestore (that is, hardcode the user's home directory) and cannot use the exact same generic file which I would copy/paste for every user.
To sum up there are three problems here:
- in the system config, there's no way to specify a default value for rootless users for all parameters, only
rootless_storage_pathis available to specify a rootlessgraphroot. - having
$HOME/.config/containers/storage.confmakes rootless Podman ignore/etc/containers/storage.confcompletely, even for parameters which are specified in/etcbut not in$HOME. I would expect the config in$HOMEto inherit the config in/etc/, which would also solve the first problem. imagestoredoes not support environment variable substitution likegraphrootorrootless_storage_pathdo.
Thank you for your time!