I am new to docker and trying to create docker file from SLES 15 base image:
FROM <base image - SLES 15 >
LABEL <label> \
Version="1.0"
In docker-compose.yml , I have mentioned :
working_dir: $PWD
volumes:
- $PWD/../../:$PWD/../../
When I start docker container, I am not able to access any file or directory with following error:
ls: cannot access '<directory/file name>': Operation not permitted
total 0
d????????? ? ? ? ? ? <directory-name>
I tries possible solutions suggested like :
- Setting file permissions with chown/chmod
- Disable selinux
Any idea about root cause of this issue and possible solution?
Similar issue from stackoverflow : No access rights in Docker Container when using SLES15 and *Suse Container
id
command with each image to see with what user are you running in them – Vanegasid
( user and group ) is 0 and user is root inside container. I also tried to set it specific to user group of my local machine where I am trying to run container. I am still gettingls: cannot access '<directory/file name>': Operation not permitted
when tryingls -n
orls -l
– Hardtack--priveledged
and-u 0
? – VanegasRUN useradd -ms /bin/bash -u 1000 -U dockerbuilduser && \ echo "dockerbuilduser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dockerbuilduser && \ mkdir /home/dockerbuilduser/.gradle && \ chown 1000:1000 /home/dockerbuilduser && \ chmod 777 -R /home/dockerbuilduser && \ chmod 0400 /etc/sudoers.d/dockerbuilduser USER dockerbuilduser
Created user with same uid of host machine user and also assigned ownership. Still when I docd /home/dockerbuilduser
and thenls -l
I get permission error. same error for newly created folder as well – Hardtack--privileged
flag. I could runls -l
without permission error. However as per my understanding it is not recommended to use privileged containers. How can I solve this issue without privileged container. – Hardtacknobody:nogroup
? do you have a requirement to use this exact distro? – Vanegasdrwxrwxrwx 1 0 0 27 Jan 24 17:24 <folder-name>
( i.e. uid and gid as 0 and user as root ) . If I add dockerbuilduser then it'sdrwxrwxrwx 1 1000 1000 27 Jan 24 17:24 <folder-name>
( i.e. uid and gid as 1000 and user as dockerbuilduser). Sorry I didn't understand your point about changing ownership tonobody:nogroup
. Yes I have requirement to use this exact distro. – Hardtackdockerbuilduser
user, did it work? – Vanegas