code-server: Error: EACCES: permission denied
[root@localhost ~]# docker run -t -p 127.0.0.1:8443:8443 -v "${PWD}:/root/project" codercom/code-server code-server --allow-http --no-auth
Unable to find image 'codercom/code-server:latest' locally
Trying to pull repository docker.io/codercom/code-server ...
latest: Pulling from docker.io/codercom/code-server
e58ad9fd24ca: Pull complete
0a4c669d2dea: Pull complete
ab60767ef52b: Pull complete
8cc3b738fbea: Pull complete
4a49f00acafc: Pull complete
15aff5fdd28f: Pull complete
1a344d81f432: Pull complete
f079d5b4236e: Pull complete
Digest: sha256:d96615907185d67fcc75655eef3eee28399efb968aaa5e1dc319fa064db3fb08
Status: Downloaded newer image for docker.io/codercom/code-server:latest
ERROR { Error: EACCES: permission denied, mkdir '/root/project/code-server'
[stack]: 'Error: EACCES: permission denied, mkdir \'/root/project/code-server\'',
[message]: 'EACCES: permission denied, mkdir \'/root/project/code-server\'',
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/root/project/code-server' }
free(): invalid pointer
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (6 by maintainers)
Commits related to this issue
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
- Significantly improve the Dockerfile - Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the ... — committed to coder/code-server by nhooyr 5 years ago
You must give permissions to the group: coder
docker exec -it app_name_1 bashchown coder:coder /home/coder/project -RI have the seme problem and nothing help. Any progress?
Ran into this problem when I was trying out code-server. Seems to me like the typical Docker problem of mismatch between host UID/GIDs and container UID/GIDs. I solved this by running the following commands instead of the one suggested in the readme:
In my (somewhat limited) experience, using
--user $(id -u):$(id -g)seems to be the best way of handling bind mounts where files should be owned by the current user. It’s not perfect though: Any files created by the user duringdocker buildwill have a different UID and GID which could cause new problems…EDIT: It actually works fine for me without the
--userflag as long as${HOME}/.local/share/code-serverexists, but any files created inside code-server will have the UID and GID of the user inside the container which may or may not be the same as the user on the host system that is executing thedocker runcommand.It seems that the container tries to create a mounting point on a host system with uid 0 (root) when such a directory not exist and causing the permission error on writing after the creation.
My suggestion as a workaround is, changing owner of the problematical directory after failing to run the container, than try to run the container again.
Hi Guys, i had the same issue and edited the docker run string to be a different destination…
${HOME}/.local/share/code-server:/home/code/docker/test/.local/share/code-server"
The segment in bold was a seperate path I’d set up locally. Previously it was /coder/ which didn’t exist.
Don’t run code-server as root and don’t use /root directory. Use some other user and it’s home directory. If you already have stuff in root here’s how to move:
sudo usermod -a -G docker servermv /root/project_folder /home/server/project_folderand transfer ownershipchown server -R /home/server/project_folderdocker run -d --name="coder" -it -p 8080:8080 -v "/home/server:/home/coder/project" codercom/code-serverReopening this since we haven’t slated a real fix, vetoing @nhooyr’s close.
I was also getting the same error for certain directories. However, I manually creates a ‘code-server’ directory and ran the docker commands again. It now works just fine.