search

Home  >  Q&A  >  body text

docker安装后出现Cannot connect to the Docker daemon.

系统:ubuntu16.04
我是按照docker的文档上安装的 https://docs.docker.com/linux/step_one/
安装完成后docker的ps pull search run命令都会报这个错 Cannot connect to the Docker daemon. Is the docker daemon running on this host?

在文档上看到让我检查 DOCKER_HOST 这环境变量,然而我并不知道在哪检查

给我你的怀抱给我你的怀抱2760 days ago1247

reply all(6)I'll reply

  • 阿神

    阿神2017-04-24 16:01:19

    I also had a similar error.
    Because, I forgot to start the docker service.
    service docker start

    reply
    0
  • 習慣沉默

    習慣沉默2017-04-24 16:01:19

    Please usesudo

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-24 16:01:19

    You need to add user into docker group. by 'sudo gpasswd -a xxxx docker' (xxx is your user name)
    Then restart your computer.
    This problem should be solved.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-24 16:01:19

    docker-machine restart&&eval "$(docker-machine env default)"&&docker-machine env just run this sequence

    reply
    0
  • 世界只因有你

    世界只因有你2017-04-24 16:01:19

    • Look at the default configuration of docker startup/etc/default/docker没问题呗,然后重启服务service docker restart.

    • sudo docker -H unix:///var/run/docker.sock -d &
      Use -H to change the docker process to listen to the specified IP and port. By default, docker will listen to unix:///var/run/docker.sock and only allow local root users to connect. You can refer to "Docker Tutorial-Learn Basic Commands"

    • Reinstall docker.

    reply
    0
  • 阿神

    阿神2017-04-24 16:01:19

    su root # First switch to the root user, and then execute the following command
    systemctl enable docker # Automatically start docker at boot

    systemctl start docker # Start docker
    systemctl restart docker # Restart docker

    reply
    0
  • Cancelreply