On 9/22/22 06:45, GHui Wu via Podman wrote:
I haven't permission in container to access the directory which
is mounted from host.
$ podman run -dt -v ./mysql/data:/mysql centos:7.9.2009 sleep 36000
$ podman exec -it 920b52079e67 /bin/bash
[root@920b52079e67 mysql]# useradd mysql
[root@920b52079e67 mysql]# su - mysql
[mysql@920b52079e67 mysql]$ cd /
[mysql@920b52079e67 /]$ ll
total 44
-rw-r--r-- 1 root root 12114 Nov 13 2020 anaconda-post.log
lrwxrwxrwx 1 root root 7 Nov 13 2020 bin -> usr/bin
drwxr-xr-x 5 root root 360 Sep 22 10:39 dev
drwxr-xr-x 47 root root 460 Sep 22 10:40 etc
drwxr-xr-x 3 root root 60 Sep 22 10:40 home
lrwxrwxrwx 1 root root 7 Nov 13 2020 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Nov 13 2020 lib64 -> usr/lib64
drwxr-xr-x 2 root root 4096 Apr 11 2018 media
drwxr-xr-x 2 root root 4096 Apr 11 2018 mnt
drwxrwxrwx 2 root root 4096 Sep 22 10:28 mysql
drwxr-xr-x 2 root root 4096 Apr 11 2018 opt
dr-xr-xr-x 1394 65534 65534 0 Sep 22 10:39 proc
dr-xr-x--- 2 root root 4096 Nov 13 2020 root
drwxr-xr-x 11 root root 60 Sep 22 10:39 run
lrwxrwxrwx 1 root root 8 Nov 13 2020 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 Apr 11 2018 srv
dr-xr-xr-x 13 65534 65534 0 Sep 22 10:01 sys
drwxrwxrwx 7 root root 4096 Nov 13 2020 tmp
drwxr-xr-x 13 root root 4096 Nov 13 2020 usr
drwxr-xr-x 18 root root 80 Sep 22 10:40 var
[mysql@920b52079e67 /]$ ls mysql/
ls: cannot open directory mysql/: Permission denied
[mysql@920b52079e67 /]$
_______________________________________________
Podman mailing list -- podman(a)lists.podman.io
To unsubscribe send an email to podman-leave(a)lists.podman.io
Most likely SELinux or User Namespace.
:Z,U on the volume mount will probably fix this.
https://www.redhat.com/sysadmin/container-permission-denied-errors