I wrote two troubleshooting tips that describes how --uidmap and
--gidmap can be used to handle situations like that:
https://github.com/containers/podman/blob/main/troubleshooting.md#34-pass...
https://github.com/containers/podman/blob/main/troubleshooting.md#33-cont...
Another alternative is to use the volume option ":U".
Quote
"The :U suffix tells Podman to use the correct host UID and GID based
on the UID and GID within the container, to change recursively the
owner and group of the source volume."
from
https://docs.podman.io/en/latest/markdown/podman-run.1.html#volume-v-sour...
If you can use --uidmap and --gidmap (or --userns=keep-id), you
probably don't need to run chown or use ":U".
Regards,
Erik Sjölund
On Tue, Feb 15, 2022 at 10:15 PM Prafulla Giri via Podman
<podman(a)lists.podman.io> wrote:
>
> Hello there,
>
> I have bind-mounted a local dir inside a container. Once the container is closed the
directory permissions are
> changed to a subuid and I have to run `podman unshare chown -R 0:0 /path/to/dir`
manually if I want to do anything
> with the bind-mounted directory. I was wondering if there is a method whereby a
container (or a pod) could be configured
> to do this automatically? I'd be glad to know about it (or any other ways to get
around this minor issue).
>
> Thank you.
> _______________________________________________
> Podman mailing list -- podman(a)lists.podman.io
> To unsubscribe send an email to podman-leave(a)lists.podman.io