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

dial unix /var/run/docker.sock: permission denied #5314

Closed
cdekok opened this Issue Apr 19, 2014 · 28 comments

Comments

Projects
None yet
@cdekok

cdekok commented Apr 19, 2014

I installed docker.io on ubuntu 14.04 only i always get this message:

dial unix /var/run/docker.sock: permission denied

I read this was an old problem, i see it does belong to the group docker, and I have tried adding myself to the docker group to but i still get this message, does anybody know how to solve it?

The version that comes with ubuntu is: Docker version 0.9.1, build 3600720

@lkoenigsberger

This comment has been minimized.

Show comment
Hide comment
@lkoenigsberger

lkoenigsberger Apr 19, 2014

I`ve the same problem. Thought first it is a config error or an error because of running the VM in Microsoft Azure ;-) But I'm not alone!!
What are we missing??

lkoenigsberger commented Apr 19, 2014

I`ve the same problem. Thought first it is a config error or an error because of running the VM in Microsoft Azure ;-) But I'm not alone!!
What are we missing??

@tianon

This comment has been minimized.

Show comment
Hide comment
@tianon

tianon Apr 19, 2014

Member

Did you log out and back in after adding yourself to the docker group?

Member

tianon commented Apr 19, 2014

Did you log out and back in after adding yourself to the docker group?

@lkoenigsberger

This comment has been minimized.

Show comment
Hide comment
@lkoenigsberger

lkoenigsberger Apr 19, 2014

Sorry yes that was the problem!! After rebooting the server it worked!! Thanks

lkoenigsberger commented Apr 19, 2014

Sorry yes that was the problem!! After rebooting the server it worked!! Thanks

@tianon

This comment has been minimized.

Show comment
Hide comment
@tianon

tianon Apr 19, 2014

Member

@Mech7 was that the issue for you as well?

Member

tianon commented Apr 19, 2014

@Mech7 was that the issue for you as well?

@cdekok

This comment has been minimized.

Show comment
Hide comment
@cdekok

cdekok Apr 19, 2014

Yes seems to be working now thanks :)

cdekok commented Apr 19, 2014

Yes seems to be working now thanks :)

@cdekok cdekok closed this Apr 19, 2014

@tuminoid

This comment has been minimized.

Show comment
Hide comment
@tuminoid

tuminoid May 15, 2014

This issue still persists on Trusty and Docker 0.9.1, build 3600720.
I have rebooted. Running kernel 3.14.2-lowlatency from Ubuntu mainline PPA.

$ groups
tumi adm cdrom sudo dip plugdev lpadmin sambashare docker

$ docker -d
[/var/lib/docker|a0e25760] +job serveapi(unix:///var/run/docker.sock)
[/var/lib/docker|a0e25760] +job initserver()
[/var/lib/docker|a0e25760.initserver()] Creating server
2014/05/15 08:10:33 Listening for HTTP on unix (/var/run/docker.sock)
listen unix /var/run/docker.sock: bind: permission denied
[/var/lib/docker|a0e25760] -job serveapi(unix:///var/run/docker.sock) = ERR (1)
2014/05/15 08:10:33 listen unix /var/run/docker.sock: bind: permission denied

$ sudo start docker.io
docker.io start/running, process 16801

$ dmesg | tail -n5
[ 1212.552302] init: docker.io main process ended, respawning
[ 1212.583319] init: docker.io main process (17116) terminated with status 1
[ 1212.583329] init: docker.io main process ended, respawning
[ 1212.616100] init: docker.io main process (17151) terminated with status 1
[ 1212.616111] init: docker.io respawning too fast, stopped

$ sudo docker -d
[/var/lib/docker|e0b714e0] +job serveapi(unix:///var/run/docker.sock)
[/var/lib/docker|e0b714e0] +job initserver()
[/var/lib/docker|e0b714e0.initserver()] Creating server
2014/05/15 08:11:00 Listening for HTTP on unix (/var/run/docker.sock)
listen unix /var/run/docker.sock: bind: permission denied
[/var/lib/docker|e0b714e0] -job serveapi(unix:///var/run/docker.sock) = ERR (1)
2014/05/15 08:11:00 listen unix /var/run/docker.sock: bind: permission denied

tuminoid commented May 15, 2014

This issue still persists on Trusty and Docker 0.9.1, build 3600720.
I have rebooted. Running kernel 3.14.2-lowlatency from Ubuntu mainline PPA.

$ groups
tumi adm cdrom sudo dip plugdev lpadmin sambashare docker

$ docker -d
[/var/lib/docker|a0e25760] +job serveapi(unix:///var/run/docker.sock)
[/var/lib/docker|a0e25760] +job initserver()
[/var/lib/docker|a0e25760.initserver()] Creating server
2014/05/15 08:10:33 Listening for HTTP on unix (/var/run/docker.sock)
listen unix /var/run/docker.sock: bind: permission denied
[/var/lib/docker|a0e25760] -job serveapi(unix:///var/run/docker.sock) = ERR (1)
2014/05/15 08:10:33 listen unix /var/run/docker.sock: bind: permission denied

$ sudo start docker.io
docker.io start/running, process 16801

$ dmesg | tail -n5
[ 1212.552302] init: docker.io main process ended, respawning
[ 1212.583319] init: docker.io main process (17116) terminated with status 1
[ 1212.583329] init: docker.io main process ended, respawning
[ 1212.616100] init: docker.io main process (17151) terminated with status 1
[ 1212.616111] init: docker.io respawning too fast, stopped

$ sudo docker -d
[/var/lib/docker|e0b714e0] +job serveapi(unix:///var/run/docker.sock)
[/var/lib/docker|e0b714e0] +job initserver()
[/var/lib/docker|e0b714e0.initserver()] Creating server
2014/05/15 08:11:00 Listening for HTTP on unix (/var/run/docker.sock)
listen unix /var/run/docker.sock: bind: permission denied
[/var/lib/docker|e0b714e0] -job serveapi(unix:///var/run/docker.sock) = ERR (1)
2014/05/15 08:11:00 listen unix /var/run/docker.sock: bind: permission denied

andresriancho added a commit to andresriancho/docker-AMI that referenced this issue Jun 30, 2014

@rvalyi

This comment has been minimized.

Show comment
Hide comment
@rvalyi

rvalyi Jul 11, 2014

Hello,

I'm running into that "permission denied" issue with Docker version 1.1.1, build bd609d2
But my use case is Docker inside LXC: my Host is an Ubuntu Trusty, then I have a Vagrant LXC (Raring or Trusty) where I try to run Dokku and Docker.
I tried re-login, and could ensure root was in the docker group. So proposed solutions didn't make the cut for me.

But then I tried the same Vagrant configuration with Raring and the standard virtualbox provider instead of LXC, then Docker just worked...

If you want to try to reproduce, I just do Vagrant up with this Vagrant file:
https://github.com/fgrehm/chef-dokku/tree/test_kitchen_migration
(yes this test_kitchen_migration branch)
This works (eventually adding default['docker']['image_cmd_timeout'] = 3000 in attributes/default.rb in case of timeout)

If instead I modify the Vagrantfile to use config.vm.box = 'fgrehm/raring64-lxc instead of just raring64
and if I start with vagrant up --provider=lxc, then I run into the "permission denied issue" when the Dokku recipe tries to launch Docker (or if I SSH in the box and try manually).

Does this helps? cc @mitchellh @fgrehm

rvalyi commented Jul 11, 2014

Hello,

I'm running into that "permission denied" issue with Docker version 1.1.1, build bd609d2
But my use case is Docker inside LXC: my Host is an Ubuntu Trusty, then I have a Vagrant LXC (Raring or Trusty) where I try to run Dokku and Docker.
I tried re-login, and could ensure root was in the docker group. So proposed solutions didn't make the cut for me.

But then I tried the same Vagrant configuration with Raring and the standard virtualbox provider instead of LXC, then Docker just worked...

If you want to try to reproduce, I just do Vagrant up with this Vagrant file:
https://github.com/fgrehm/chef-dokku/tree/test_kitchen_migration
(yes this test_kitchen_migration branch)
This works (eventually adding default['docker']['image_cmd_timeout'] = 3000 in attributes/default.rb in case of timeout)

If instead I modify the Vagrantfile to use config.vm.box = 'fgrehm/raring64-lxc instead of just raring64
and if I start with vagrant up --provider=lxc, then I run into the "permission denied issue" when the Dokku recipe tries to launch Docker (or if I SSH in the box and try manually).

Does this helps? cc @mitchellh @fgrehm

@jessfraz

This comment has been minimized.

Show comment
Hide comment
@jessfraz

jessfraz Sep 24, 2014

Contributor

What init system are you using?

Contributor

jessfraz commented Sep 24, 2014

What init system are you using?

@enricostano

This comment has been minimized.

Show comment
Hide comment
@enricostano

enricostano Oct 14, 2014

I'm getting the same too on a vagrant VM (ubuntu 14), I have to use sudo docker info to avoid the error...

enricostano commented Oct 14, 2014

I'm getting the same too on a vagrant VM (ubuntu 14), I have to use sudo docker info to avoid the error...

@cdekok

This comment has been minimized.

Show comment
Hide comment
@cdekok

cdekok Oct 27, 2014

The issue comes back with me too :(
Docker version 1.3.0, build c78088f

cdekok commented Oct 27, 2014

The issue comes back with me too :(
Docker version 1.3.0, build c78088f

@mattupstate

This comment has been minimized.

Show comment
Hide comment

mattupstate commented Oct 28, 2014

@Mech7 same here

@cyroxx

This comment has been minimized.

Show comment
Hide comment
@cyroxx

cyroxx Nov 3, 2014

@Mech7 @mattupstate
On Ubuntu 14.04, I am also using the Docker version 1.3.0, build c78088f.

Adding myself to the docker group by sudo usermod -a -G docker <username> and rebooting (logout/login might have worked as well) did the job for me. I do not see the permission denied anymore when I issue docker commands.

cyroxx commented Nov 3, 2014

@Mech7 @mattupstate
On Ubuntu 14.04, I am also using the Docker version 1.3.0, build c78088f.

Adding myself to the docker group by sudo usermod -a -G docker <username> and rebooting (logout/login might have worked as well) did the job for me. I do not see the permission denied anymore when I issue docker commands.

@javiervivanco

This comment has been minimized.

Show comment
Hide comment
@javiervivanco

javiervivanco Nov 6, 2014

@cyroxx Thank you. It works!

javiervivanco commented Nov 6, 2014

@cyroxx Thank you. It works!

@ssebastianj

This comment has been minimized.

Show comment
Hide comment
@ssebastianj

ssebastianj Nov 8, 2014

Adding myself to the docker group by sudo usermod -a -G docker <username> and rebooting (logout/login might have worked as well) did the job for me. I do not see the permission denied anymore when I issue docker commands.

Thanks!! It worked for me on Ubuntu 14.10 and Docker version 1.2.0, build fa7b24f

ssebastianj commented Nov 8, 2014

Adding myself to the docker group by sudo usermod -a -G docker <username> and rebooting (logout/login might have worked as well) did the job for me. I do not see the permission denied anymore when I issue docker commands.

Thanks!! It worked for me on Ubuntu 14.10 and Docker version 1.2.0, build fa7b24f

@rvanrijn

This comment has been minimized.

Show comment
Hide comment
@rvanrijn

rvanrijn Nov 16, 2014

@cyroxx Thank you. It works! I wasted a couple of hours...now I am happy :)

rvanrijn commented Nov 16, 2014

@cyroxx Thank you. It works! I wasted a couple of hours...now I am happy :)

@jbruni

This comment has been minimized.

Show comment
Hide comment
@jbruni

jbruni Jan 31, 2015

Contributor

I also had to add my user to "docker" group, by sudo usermod -a -G docker <username>... Is this documented?

Contributor

jbruni commented Jan 31, 2015

I also had to add my user to "docker" group, by sudo usermod -a -G docker <username>... Is this documented?

@jessfraz

This comment has been minimized.

Show comment
Hide comment
@jessfraz

jessfraz Jan 31, 2015

Contributor

yes multiple places, but here is one example
http://docs.docker.com/installation/ubuntulinux/#giving-non-root-access

On Sat, Jan 31, 2015 at 1:02 AM, J Bruni notifications@github.com wrote:

I also had to add my user to "docker" group, by sudo usermod -a -G docker
... Is this documented?


Reply to this email directly or view it on GitHub
#5314 (comment).

Contributor

jessfraz commented Jan 31, 2015

yes multiple places, but here is one example
http://docs.docker.com/installation/ubuntulinux/#giving-non-root-access

On Sat, Jan 31, 2015 at 1:02 AM, J Bruni notifications@github.com wrote:

I also had to add my user to "docker" group, by sudo usermod -a -G docker
... Is this documented?


Reply to this email directly or view it on GitHub
#5314 (comment).

@skullncode

This comment has been minimized.

Show comment
Hide comment
@skullncode

skullncode Mar 13, 2015

thank you @cyroxx! that worked!

skullncode commented Mar 13, 2015

thank you @cyroxx! that worked!

@907th

This comment has been minimized.

Show comment
Hide comment
@907th

907th Mar 22, 2015

The @cyroxx 's solution works! It is explained in "Giving non-root access" section of official Docker docs.

907th commented Mar 22, 2015

The @cyroxx 's solution works! It is explained in "Giving non-root access" section of official Docker docs.

jdivock added a commit to jdivock/docker that referenced this issue Apr 14, 2015

Update basic setup instructions
Without adding the user to the group you're going to hit nasty TLS errors. Figured I'd save the next guy the hassle.

Problem more accurately described here:
moby#5314

jdivock added a commit to jdivock/docker that referenced this issue Apr 14, 2015

Update basic setup instructions
Without adding the user to the group you're going to hit nasty TLS errors. Figured I'd save the next guy the hassle.

Problem more accurately described here:
moby#5314

Signed-off-by: Jason Divock <jdivock@box.com>
@meawoppl

This comment has been minimized.

Show comment
Hide comment
@meawoppl

meawoppl May 9, 2015

The instructions here need a bump too:
https://docs.docker.com/installation/ubuntulinux/

It suggests the user change at the end of install, but following the install directions directly on 14.04 will eventually lead you to this issue post!

meawoppl commented May 9, 2015

The instructions here need a bump too:
https://docs.docker.com/installation/ubuntulinux/

It suggests the user change at the end of install, but following the install directions directly on 14.04 will eventually lead you to this issue post!

@psachin

This comment has been minimized.

Show comment
Hide comment
@psachin

psachin Apr 13, 2016

@tianon Logout->Login sometimes is not appropriate, as we have process running. Any idea if this related to docker ? If yes, then it should be marked as bug.

psachin commented Apr 13, 2016

@tianon Logout->Login sometimes is not appropriate, as we have process running. Any idea if this related to docker ? If yes, then it should be marked as bug.

@Mik1337

This comment has been minimized.

Show comment
Hide comment
@Mik1337

Mik1337 Jan 24, 2017

Had the same problem, tried logging out and logging back in and that did not fix it, but when I rebooted my machine I did not get any errors running docker commands with my non-root use.

tl;dr: if logging out and logging back does not work, try rebooting

Mik1337 commented Jan 24, 2017

Had the same problem, tried logging out and logging back in and that did not fix it, but when I rebooted my machine I did not get any errors running docker commands with my non-root use.

tl;dr: if logging out and logging back does not work, try rebooting

@saadaouad

This comment has been minimized.

Show comment
Hide comment
@saadaouad

saadaouad commented Feb 8, 2017

Thanks @cyroxx +1

@martiuh

This comment has been minimized.

Show comment
Hide comment
@martiuh

martiuh Feb 9, 2017

I added myself to the docker group, then I did log out and did log in, after that I checked if I was in the docker group

$ groups
adm cdrom sudo dip plugdev lpadmin sambashare docker
#I was in the group

But couldn't run docker run hello-world

I checked if the docker service was running

$ sudo service docker status
#Everything was fine, docker was active

What I did next was to restart the docker service with:
$ sudo service docker restart
after the restart I was able to do $ docker run without sudo, hope this helps someone 😃

martiuh commented Feb 9, 2017

I added myself to the docker group, then I did log out and did log in, after that I checked if I was in the docker group

$ groups
adm cdrom sudo dip plugdev lpadmin sambashare docker
#I was in the group

But couldn't run docker run hello-world

I checked if the docker service was running

$ sudo service docker status
#Everything was fine, docker was active

What I did next was to restart the docker service with:
$ sudo service docker restart
after the restart I was able to do $ docker run without sudo, hope this helps someone 😃

@tahir-gvs

This comment has been minimized.

Show comment
Hide comment
@tahir-gvs

tahir-gvs Feb 22, 2017

A side note: If you are trying to connect to socket from within a container, make sure you have the group docker defined within the container too.

$ docker exec -it yourcontainer bash
$ whoami
$ groups

If you see that docker group is not there in your container, edit /etc/group file to make an entry something like (see group file syntax)

docker:x:999:jenkins

Replace jenkins with container User. A container restart may be required after editing /etc/group file.

tahir-gvs commented Feb 22, 2017

A side note: If you are trying to connect to socket from within a container, make sure you have the group docker defined within the container too.

$ docker exec -it yourcontainer bash
$ whoami
$ groups

If you see that docker group is not there in your container, edit /etc/group file to make an entry something like (see group file syntax)

docker:x:999:jenkins

Replace jenkins with container User. A container restart may be required after editing /etc/group file.

@2pay

This comment has been minimized.

Show comment
Hide comment
@2pay

2pay May 2, 2017

You can fix this error by add you to docker group:

$ sudo usermod -aG docker $(whoami)
$ sudo usermod -aG docker your_username

when logout and login back

2pay commented May 2, 2017

You can fix this error by add you to docker group:

$ sudo usermod -aG docker $(whoami)
$ sudo usermod -aG docker your_username

when logout and login back

@armaandhir

This comment has been minimized.

Show comment
Hide comment
@armaandhir

armaandhir May 9, 2017

I have ubuntu as a vm. Did everything as mentioned above and even see docker in groups but still get this error.

armaandhir commented May 9, 2017

I have ubuntu as a vm. Did everything as mentioned above and even see docker in groups but still get this error.

@chinglinwen

This comment has been minimized.

Show comment
Hide comment
@chinglinwen

chinglinwen Jan 10, 2018

After adding user to the docker group, I find out that newgrp docker may work without logout and login. ( try id command to see the difference, the docker group will show up now. )

chinglinwen commented Jan 10, 2018

After adding user to the docker group, I find out that newgrp docker may work without logout and login. ( try id command to see the difference, the docker group will show up now. )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment