I’ve switched from docker to podman in Fedora 30 with success but after upgrading to 31, my podman container is having “Permission denied” when using a mounted volume.
My use case is very simple. I have an image loaded with Ubuntu 18.04 and a cross platform Linux framework for compiling embedded builds, called Petalinux. I run the container with a volume command line switch to mount a host directory and compile those files with Petalinux. That worked fine until Fedora 31.
The command would be:
$ podman run -ti --volume `pwd`:/home/plnx/project:z tux/petalinux
The files are properly mounted in the container, but they belong to “root” and so I’m unable to write to them. There seems to be some user mapping that changed between versions.
I’ve read about cgroups v1 upgrading to v2 but I’m uncertain how to test.
I have SElinux set to Permissive.
I’ve rebuilt the image with F31 podman with no avail.
All files are own by my user and reside in the home directory, mounted exec.
Please help. I’ve been stuck on this issue for days and exhausted all means for a fix.
Thanks for your response @FranciscoD. I tried the --userns switch but didn’t help, though it’s not far off because the issue is related to namespaces.
However, I was able to work-around/fix the issue, taking concepts from this post about running as non-root user
The limitation came because inside the container, the user is changed to a non-root user because Petalinux complains when run as root. The user permissions on the mounted directory change to a namespace different from the host directory permissions, even though both are run by the same host user. The key command was podman unshare chown user:user $PATH