skip to Main Content

Ok I’m pulling my hair out. As stated in the question title I run

docker run hello-world as my normal user and I get this…

$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///home/unclefonso/.docker/desktop/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

I run "sudo" with it and it works…

$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

I need to run WITHOUT sudo. What must I do?

Note: I am trying to follow these instructions from the docker site…https://docs.docker.com/engine/install/ubuntu/

UPDATE:

I’ve also done the following to add the docker group but…same outcome

$ sudo usermod -aG docker $USER
[sudo] password for unclefonso: 
mage@pop-os ~
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///home/unclefonso/.docker/desktop/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
mage@pop-os ~
$ groups unclefonso
unclefonso : unclefonso adm sudo kvm lpadmin docker


2

Answers


  1. add your user

    sudo usermod -aG docker $USER
    
    Login or Signup to reply.
  2. Manage Docker as a non-root user

    The Docker daemon binds to a Unix socket, not a TCP port. By default it’s the root user that owns the Unix socket, and other users can only access it using sudo. The Docker daemon always runs as the root user.

    If you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group. On some Linux distributions, the system automatically creates this group when installing Docker Engine using a package manager. In that case, there is no need for you to manually create the group.

    $ sudo usermod -aG docker $USER
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search