Skip to content

Unable to start 'cdr/code-server' in Docker container: “error EACCES: permission denied, mkdir '/home/coder/.config/code-server'” #2234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
skbergam opened this issue Oct 26, 2020 · 7 comments
Labels
waiting-for-info Waiting for more information from submitter

Comments

@skbergam
Copy link

Here's my script:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

Then I disconnect from ssh, connect back, and run this command:

docker run -it --name code-server -p 127.0.0.1:8080:8080 -v "$HOME/.config:/home/coder/.config:rw" -v "$PWD:/home/coder/project:rw" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" codercom/code-server:latest

The error I get is error EACCES: permission denied, mkdir '/home/coder/.config/code-server'.

This is on a brand new EC2 instance. Any ideas? I've been banging my head on this and I don't know how to debug further. I've tried removing the -e and -u options from the command but those don't seem to have any effect, both with and without running docker with sudo but to no avail. Thank you!

@code-asher
Copy link
Member

code-asher commented Oct 27, 2020 via email

@code-asher code-asher added the waiting-for-info Waiting for more information from submitter label Dec 2, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Jan 20, 2021

This has been fixed and the docker command example has been updated.

See https://github.com/cdr/code-server/blob/v3.8.0/doc/install.md#docker

# This will start a code-server container and expose it at http://127.0.0.1:8080.
# It will also mount your current directory into the container as `/home/coder/project`
# and forward your UID/GID so that all file system operations occur as your user outside
# the container.
#
# Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can
# easily access/modify your code-server config in $HOME/.config/code-server/config.json
# outside the container.
mkdir -p ~/.config
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
  -v "$HOME/.config:/home/coder/.config" \
  -v "$PWD:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
  -e "DOCKER_USER=$USER" \
  codercom/code-server:latest

@nhooyr nhooyr closed this as completed Jan 20, 2021
@brootware
Copy link

This has been fixed and the docker command example has been updated.

See https://github.com/cdr/code-server/blob/v3.8.0/doc/install.md#docker

# This will start a code-server container and expose it at http://127.0.0.1:8080.
# It will also mount your current directory into the container as `/home/coder/project`
# and forward your UID/GID so that all file system operations occur as your user outside
# the container.
#
# Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can
# easily access/modify your code-server config in $HOME/.config/code-server/config.json
# outside the container.
mkdir -p ~/.config
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
  -v "$HOME/.config:/home/coder/.config" \
  -v "$PWD:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
  -e "DOCKER_USER=$USER" \
  codercom/code-server:latest

I'm running into the same error using this command on rhel7. @skbergam has this been fixed for you? Is anyone else facing the same?

@jsjoeio
Copy link
Contributor

jsjoeio commented Aug 2, 2021

@brootware please open a GitHub Discussion or a bug report if you're experiencing issues!

@yonixw
Copy link

yonixw commented Aug 22, 2022

What worked for me is (with inside docker support with sudo):

  1. to create a folder, cd into it,
  2. prepare mount folder by mkdir -p home/.config
  3. Runnit this command:
docker run
  -it --name code-server 
  -p 8080:8080 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v "$(pwd)/home:/home/coder/" 
  -u "$(id -u):$(id -g)" 
  -e "DOCKER_USER=$USER" 
codercom/code-server:latest

@trangvu3103
Copy link

@yonixw Thanks a bunch! I was running into this problem all night long. None of the commands from the document working.

@aprinaprin
Copy link

cd ~/code-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-info Waiting for more information from submitter
Projects
None yet
Development

No branches or pull requests

8 participants