Replies: 1 comment
-
|
The For the workflow itself, there's a cleaner path than the delete-recreate dance: # On source host
podman volume export myvolume > myvolume.tar
# On target host - create & import in one shot
podman volume create myvolume
podman volume import myvolume myvolume.tar
# Fix SELinux labels
sudo restorecon -RF $(podman volume inspect myvolume --format '{{.Mountpoint}}')The ownership issue you hit (root instead of mapped UID) happens because A more reliable approach: use podman volume create myvolume
podman volume import myvolume myvolume.tar
# Remap ownership to match the new userns
podman unshare chown -R 0:0 $(podman volume inspect myvolume -f '{{.Mountpoint}}')
For containers with multiple users (e.g., UID 0 owns some files, UID 999 owns others): |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am moving an application to a new server.
I used
podman volume exporton the original server to export its volume to a .tar file. On my first attempt at restoring the volume on the new server, I usedpodman volume createthenpodman volume importbefore starting up the container. This caused file ownership issues: the volume, and _data directory inside it, were owned by root instead of the uid running the container (set by SubUIDMap & SubGIDMap in a systemd quadlet)I remedied this by:
_datadirectorypodman importto import the .tar file into the volume.Everything seems to be working now, but the selinux labelling is concering me.
Files that were created during initialization by the container are labeled:
system_u:object_r:container_file_t:s0Where as files that were written during the import are labeled:
unconfined_u:object_r:container_file_t:s0I was able to fix this with
restorecon -RFso I'm fairly sure everything is as it should be now.I have attempted the same export/import procedure on a VM with the same results, proving it wasn't an issue with the original volume. Is this normal? Am I doing this correctly or is there a better way?
Edit:
Another issue I have when moving volumes:
The container on the new host may have to run in a differently numbered user namespace. I'm worried that I'd break something if I manually chown the contents, especially if there are multiple users in the container. Is there an established best practice for transposing the user namepsace?
Beta Was this translation helpful? Give feedback.
All reactions