Docker command can't connect to Docker daemon

后端 未结 23 2994
有刺的猬
有刺的猬 2020-12-02 04:01

I want to make a move to Docker, so I\'ve just started to mess around with it. I\'ve installed Docker on a VirtualBox Ubuntu 15.10 (Wily Werewolf) installation and as sugges

相关标签:
23条回答
  • 2020-12-02 04:22

    Add current user to docker group:

    sudo usermod -aG docker $(whoami)

    0 讨论(0)
  • 2020-12-02 04:23

    note to self: I get the error from the question's title when I forget to run docker command with sudo:

    sudo docker run ...

    [Ubuntu 15.10]

    0 讨论(0)
  • 2020-12-02 04:25

    I have same issue while running docker.

    you can run commands as sudo user:

    sudo docker ***your command here***
    
    0 讨论(0)
  • 2020-12-02 04:26

    Perhaps this will help someone, as the error message is extremely unhelpful, and I had gone through all of the standard permission steps numerous times to no avail.

    Docker occasionally leaves ghost environment variables in place that block access, despite your system otherwise being correctly set up. The following shell commands may make it accessible again, if you have had it running at one point and it just stopped cooperating after a reboot:

    unset DOCKER_HOST
    unset DOCKER_TLS_VERIFY
    unset DOCKER_TLS_PATH
    docker ps
    

    I had a previously working docker install, and after rebooting my laptop it simply refused to work. Was correctly added to the docker user group, had the correct permissions on the socket, etc, but could still not run docker login, docker run ..., etc. This fixed it for me. Unfortunately I have to run this on each reboot. This is mentioned on a couple of github issues also as a workaround, although it seems like a bug that this is a persistent barrier to correct operation of Docker (note: I am on Arch Linux, not OSX, but this was the same issue for me).

    0 讨论(0)
  • 2020-12-02 04:27

    I have faced same error on Amazon EC2 instance. The issue got fixed after restarting the instance.

    0 讨论(0)
  • 2020-12-02 04:28

    enter as root (sudo su) and try this:

    unset DOCKER_HOST
    docker run --name mynginx1 -P -d nginx
    

    I've the same problem here, and the docker command only worked running as root, and also with this DOCKER_HOST empty

    PS: also beware that the correct and official way to install on Ubuntu is to use their apt repositories (even on 15.10), not with that "wget" thing.

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