Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied while trying to connect to the Docker daemon socket

On Ubuntu 16.04 LTS whenever trying using docker login command the following warring message will be show :

docker login
Warning: failed to get default registry endpoint from daemon (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.30/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: csomethingr
Password: 
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.30/auth: dial unix /var/run/docker.sock: connect: permission denied

Any solution?

like image 356
Chandru Avatar asked Sep 13 '17 16:09

Chandru


2 Answers

use sudo docker login

or as @Serey mentioned add your user to docker group

usermod -aG docker $USER

and disconect from your session!

like image 165
Tarun Lalwani Avatar answered Oct 20 '22 21:10

Tarun Lalwani


you have to add the user to the docker group as the other posts suggest

usermod -aG docker $USER

This change won't affect your current terminal session however. If you don't want to login/logout you can use

newgrp - docker

for the change to affect to your current terminal session.

like image 26
fschaper Avatar answered Oct 20 '22 22:10

fschaper