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 can't connect to docker daemon
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 .
答案 0 :(得分:1)
尝试不使用docker build -t tutorial .
运行此命令sudo
或使用sudo运行eval "$(docker-machine env default)"