code-server: "Insufficient permission" error on save
code-serverversion: 1.621- OS Version: Ubuntu 18.04.2 LTS (on GCP)
Description
Files cannot be saved nor folders cannot be created from the editor. This problem only started to occur on the latest release. (I think)
Steps to Reproduce
- Start the server with
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server:1.621 --allow-http --no-auth - Open the editor on another page and try to make change to any file or folder. You will get this error
Failed to save 'README.md': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser..

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 18 (7 by maintainers)
I think @DavisAre’s solution seems like the best path forward here, typically when I’ve needed to edit files from inside a container this has been the recommended approach. The alternative seems to be changing host file permissions which isn’t great…
I will note though that in my case when I try to run it with a forwarded user I get:
It’s not pretty but it solves the issue.
I’ve created an image of my own which uses the coder binary + fixuid and it is working great! I combine that with docker compose commands and I’m able to spin up lots of coder instances for myself and colleagues. Image at https://hub.docker.com/r/acondura/code-server.
I already logged a fix but its stuck at pending for god knows how long.
#679
Ok, I circumvented this by passing
-uvariables and running as current user. In my case - root. You can also specify other user’s/group’s IDs like-u 1000:1000docker run -it -p 127.0.0.1:8443:8443 -u $(id -u):$(id -g) -v "${PWD}:/home/coder/project" codercom/code-server:1.621 --allow-httpMight not be the best approach but may be helpful for someone as quick workaround without dealing with directory, file ownership.
Setting wider access settings on those files/directories worked for me - from
664to666.If access rights are not the case, you can use
chmod o+w fileorchmod o+w -R diron whole directory if needed. However, mind that this is not the safe solution.I believe it’s due to trying to edit files by user ‘docker’ or something similar (since we’re operating from inside of the container) and it is not issue with code-server itself.