kasmtech / workspaces-images

Other
730 stars 241 forks source link

folder permissions #4

Closed sadequzv710 closed 3 years ago

sadequzv710 commented 3 years ago

Hello and thanks for the great docker images. i tried all of them.all great. just wanted to mount a folder in docker container to host folder, when i do it, i cant copy any files there to access from host.it says doesn't have proper permissions. i can copy files from host only.

i use -v /root/dl:/home/kasm-user/Downloads option to do that.

how to fix this.

thanks.

mmcclaskey commented 3 years ago

@sadequzv710, the docker container is running as UID 1000 and it looks like you are trying to mount a folder from root's profile inside the container. The user inside the container would not have permissions to access that folder. You have two options.

Secure Option:

sudo mkdir /data
sudo chown 1000:1000 /data
sudo docker run -v /data:/location/inside/container ...

Not Secure Option: sudo docker run -u root -v /root/dl:/home/kasm-user/Downloads ...

The first option uses a different directory on the host and changes ownership to uid 1000 on the host so that the uid matches the container. The second option runs the container as root, which would be less secure and not advised.

sadequzv710 commented 3 years ago

I used secure option and boom.its working.

thank you very much