Docker run centos - Problem

server@ubuntu:~$ docker run centos
Ran above command but got following error:-
Any idea how to resolve following error?

docker: 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.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See ‘docker run --help’.

Because you are not accessing from root user. If wants to run from normal user then do entry in sudoers file.

Yes, Player you are right. It solved my problem.

Thanks,
paragosho

Hi @paragosho,

To run Docker as a non-root user, you have to add your user to the docker group.

  1. Create a docker group if there isn’t one: sudo groupadd docker
  2. Add your user to the docker group: sudo usermod -aG docker [non-root user]
  3. Log out and log back in so that your group membership is re-evaluated.

Hope this helps!