Cannot connect to docker daemon

前端 未结 1 1490
野的像风
野的像风 2021-01-14 12:29

I have tried everything: add user, tried it with sudo but i didnt fix it.

I tried it as a : sudo docker ps and docker ps

Docker version : 1.11.2 OS/Archlinux

相关标签:
1条回答
  • 2021-01-14 13:04

    The installation documentation states:

    The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user.

    So, To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

    To create the docker group and add your user:

    Login as a user with sudo privileges. (the one you used to install docker) Create the docker group.

    $ sudo groupadd docker
    

    Add your user to docker group.

    $ sudo usermod -aG docker $USER
    

    Log out and log back in. This ensures your user is running with the correct permissions. Verify your work by running docker without sudo.

    $ docker run hello-world
    

    If you're still getting the same error, check if the DOCKER_HOST environment variable is not set for your shell. If it is, unset it.

    $ unset DOCKER_HOST
    

    Hope this helps

    0 讨论(0)
提交回复
热议问题