How to change rootless users' container storage location
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
Issue
- How can I change the container storage location for rootless users?
- User's home directories use autofs and need to change the container storage location.
Resolution
-
There are 2 alternative ways to change the storage location for rootless users:
-
Change
rootless_storage_path
for all rootless users:
- Modify
rootless_storage_path
under/etc/containers/storage.conf
:
rootless_storage_path = "/app/$USER"
- Change
graphroot
for a specific user:
- Modify
graphroot
in~/.config/containers/storage.conf
(create if necessary):
[storage]
driver = "overlay"
runroot = "/run/user/1000"
graphroot = "<path-to-non-NFS-directory>"
[storage.options]
size = ""
remap-uids = ""
remap-gids = ""
remap-user = ""
remap-group = ""
ostree_repo = ""
skip_mount_home = ""
mount_program = "/usr/bin/fuse-overlayfs"
- Run
podman info
and verifygraphRoot
field.
NOTE:
- Whenever graphRoot of a rootless user is changed to a different path, the SELinux labels for this location should also be changed appropriately
- Following commands needs to be run to change the labels,
# semanage fcontext -a -t container_var_lib_t 'graphRootDirectory(/.*)?'
# restorecon -Rv graphRootDirectory
,where graphRootDirectory is the new location specified in storage.conf
Root Cause
- Change rootless users' container storage due to insufficient spaces under the home directory.
- Using autofs for container storage is not efficient
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments