![](/img/trans.png)
[英]Docker : Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[英]Docker, Cannot connect to the Docker daemon. Is the docker daemon running on this host?
MacOS Sierra 10.12.2
Docker 1.12.5
Docker的新手,每次我尝试构建Docker文件时都会出现此错误:
$ sudo docker build -t tutorial .
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
我按照这篇SO帖子中的说明进行操作,但问题仍未解决: Docker无法连接到Docker守护程序
Docker版本:
$ docker --version
Docker version 1.12.5, build ...
目录:
$ ls
Dockerfile README.md apache supervisord
为Docker启动虚拟机:
$ docker-machine start
Starting "default"...
Machine "default" is already running.
...
$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.00.00:2576" #edit
export DOCKER_CERT_PATH="/Users/myUser/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $(docker-machine env)
...
$ eval "$(docker-machine env default)"
再次运行:
$ sudo docker build -t tutorial .
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
已解决:确实可以在没有sudo
情况下工作:
$ docker build -t tutorial .
尝试运行此命令docker build -t tutorial .
没有sudo
或使用sudo
运行eval "$(docker-machine env default)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.