Writing to mounted storage fails with permission denied

Viewed 97

here is ls -ld folder_in_question on a host:

lrwxrwxrwx 1 xxx xxx 22 ноя 11 06:40 ../doc -> /mnt/nfs/2600/data/doc

here is ls -ld folder_in_question on from a container:

drwxrwxr-x 3 1002 1002 4096 Nov 11 03:31 /home/xxx/data

I can create and edit files from host, yet when I try say

FROM openjdk:9-jre-slim
#...
RUN  adduser --disabled-password --gecos '' xxx
RUN  mkdir /home/xxx/data
RUN  chown -R xxx:xxx /home/xxx/data
#...
CMD echo "hello" >> /home/xxx/data/test

and run container from my user (as well as from root, default) I get:

sudo docker run -u xxx -it -v /home/xxx/doc:/home/xxx/data x/o:latest

/bin/sh: 1: cannot create /home/xxx/data/test: Permission denied

Same happens if I provide direct path to Docker -v. How such problem can be solved, what steps shall I take?

0 Answers
Related