Skip to content

Permission issue, cannot start container #910

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
mkono87 opened this issue Aug 15, 2019 · 8 comments
Closed

Permission issue, cannot start container #910

mkono87 opened this issue Aug 15, 2019 · 8 comments

Comments

@mkono87
Copy link

mkono87 commented Aug 15, 2019

Description

Used the example to create a docker-compose but im getting permisson errors and the container wont start.

  vscode:
    image: codercom/code-server
    container_name: vscode
    ports:
      - 8443:8443
    volumes:
      - /srv/docker/:/home/coder/project
    command: code-server --no-auth --disable-telemetry
ERROR { [Error: EACCES: permission denied, mkdir '/home/coder/project/code-server']


  [stack]:


   'Error: EACCES: permission denied, mkdir \'/home/coder/project/code-server\'',

�
  [message]:


   'EACCES: permission denied, mkdir \'/home/coder/project/code-server\'',


  errno: -13,


  code: 'EACCES',


  syscall: 'mkdir',


  path: '/home/coder/project/code-server' }

Related Issues

@deansheather
Copy link
Member

What's the UID that owns /srv/docker on the host? The user in the container is UID 1000, and there's no translation to the UID on the host unfortunately.

@mkono87
Copy link
Author

mkono87 commented Aug 15, 2019

@deansheather That folder is owned by root. I was hoping this could have been a solution to editing my docker folders for various containers easily.

@BirkhoffLee
Copy link

Same issue here. Any workarounds?

@sr229
Copy link
Contributor

sr229 commented Nov 7, 2019

Requesting further information. Failure to reply means it was fixed in your end and I'll close this automatically after 3 days.

@mkono87
Copy link
Author

mkono87 commented Nov 7, 2019

Requesting further information. Failure to reply means it was fixed in your end and I'll close this automatically after 3 days.

By this weekend il give it a shot again. I'm using a standard do ker setup on Ubuntu 18.04. I just wanted to have access to all appdata without having to 777 it all.

@finzzz
Copy link

finzzz commented Dec 15, 2019

temporary fix:

sudo chmod -R 777 /path/to/project
sudo chmod -R 777 /path/to/.local

@demyxco
Copy link

demyxco commented Dec 15, 2019

@mkono87 @BirkhoffLee @finzzz this is expected Docker behavior. The permission is denied because when you use bind mounts (/path/on/host:/path/in/container), Docker will create that directory on both sides if both directories don't exist on either host/container and since Docker itself runs as root, it will create it as root. Since the code-server image runs as a non-priv user (coder), it can't write to that root directory created by the bind mount, hence the "permission denied."

TL;DR the fix: sudo chown -R 1000:1000 /home/coder/project in the code-server terminal

Edit: Also creating the directory on the host (chown 1000:1000) beforehand also works.

@nhooyr
Copy link
Contributor

nhooyr commented Jan 30, 2020

See #1307

@nhooyr nhooyr closed this as completed Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants