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
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??
Did you log out and back in after adding yourself to the docker group?
Sorry yes that was the problem!! After rebooting the server it worked!! Thanks
@Mech7 was that the issue for you as well?
Yes seems to be working now thanks :)
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
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
What init system are you using?
I'm getting the same too on a vagrant VM (ubuntu 14), I have to use sudo docker info
to avoid the error...
The issue comes back with me too :(
Docker version 1.3.0, build c78088f
@Mech7 same here
@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 Thank you. It works!
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
@cyroxx Thank you. It works! I wasted a couple of hours...now I am happy :)
I also had to add my user to "docker" group, by sudo usermod -a -G docker <username>
... Is this documented?
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 [email protected] 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
https://github.com/docker/docker/issues/5314#issuecomment-72310285.
thank you @cyroxx! that worked!
The @cyroxx 's solution works! It is explained in "Giving non-root access" section of official Docker docs.
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!
@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.
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
Thanks @cyroxx +1
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 :smiley:
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.
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
I have ubuntu as a vm. Did everything as mentioned above and even see docker in groups but still get this error.
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. )
You don't need to reboot. The reboot was to trigger the restart of the "docker.service". Therefore, you just need "sudo systemctl restart docker.service" I have test this on CentOS7 and it works. You still need to include the user in the group as mentioned above.
FYI, the one thing I missed was that the docker group MUST be locally defined on the server in /etc/group - I am using OpenLDAP, and although everything looked fine, I still had the permission denied error until I did this.
@delta-one-one looks like that may be addressed by https://github.com/moby/moby/pull/38126 (once reviewed, tested, and merged)
how to debug if after joining the group the persmission is still not present?
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied
Ubuntu 18.04 LTS, docker 18.09.0, build 4d60db4 (running on a real hardware; sudo mode works fine)
Same issue as @1605200517, same OS/docker version and on GCE instance. In my case, it seems to happen randomly.
@martiuh s solution was the thing I was missing.
$ sudo service docker restart
I didn't find it in the docs (not so deeper search though), shouldn't it be included there?
@sam-cyglass I think yes it should.
Restarting docker did the trick
I followed the post-installation instructions and worked for me:
https://docs.docker.com/engine/install/linux-postinstall/
IMPORTANT: after making changes, reboot.
Most helpful comment
Did you log out and back in after adding yourself to the docker group?