Setting DOCKER_HOST after Docker Toolbox/Mac insta

2019-04-01 06:35发布

Mac here. I installed Docker via the Toolbox and all Docker commands yield the same error:

myuser@mymachine:~/tmp$docker info
Get http:///var/run/docker.sock/v1.20/info: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?

myuser@mymachine:~/tmp$sudo docker info
Password:
Get http:///var/run/docker.sock/v1.20/info: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?

Interestingly enough, however:

myuser@mymachine:~/tmp$docker -v
Docker version 1.8.1, build d12ea79

Google results | for this error indicate that the Toolbox did not install correctly, and that one of (or all) of the following env vars need to be set:

  • DOCKER_HOST; and/or
  • DOCKER_CERT_PATH; and/or
  • DOCKER_TLS_VERIFY

I have verified DOCKER_HOST is not set on my machine (neither env nor echo $DOCKER_HOST show it). So my concerns:

  • What are these env vars and what do they do? What are their proper values?
  • How do I permanently set them so that they persist machine restarts?

Update

Running the commands suggested by the one answer so far:

myuser@mymachine:~/tmp$docker-machine start default
Error: Host does not exist: default
myuser@mymachine:~/tmp$eval $(docker-machine env default)
Error: Host does not exist: default

Ideas?

1条回答
老娘就宠你
2楼-- · 2019-04-01 06:52

Run:

$ docker-machine start default
$ eval $(docker-machine env default)

And try again.

Those environment variables point your local Docker client to the Docker engine running in the VM. The above commands will set them appropriately.

查看更多
登录 后发表回答