I'm new to Docker, using Boot2Docker on OSX. After booting it, this message is given: To connect the Docker client to the Docker daemon, please set export DOCKERHOST=tcp://192.168.59.103:2375 Yet even without it, basic Docker commands (eg, docker run hello-world) work fine. The install instructions aren't very informative: Note: If you see a message in the terminal that looks something like this: To connect the Docker client to the Docker daemon, please set: export DOCKERHOST=tcp://192.168.59.103:2375 you can safely set the evironment variable as instructed.
![Mac Mac](/uploads/1/2/5/3/125383225/928769674.png)
If your Mac is too old, you can always use Docker Toolbox, and if it is recent enough, you have the choice between Docker Toolbox and the new Docker for Mac (they can even be both installed at the same time if VBox version is >= 4.3.30).
Knowing that it's 'safe' doesn't say why it's useful. What I'm not clear on:. What is the docker 'client'?. What is the docker 'daemon'?. What is the docker 'host'? (The Boot2Docker VM itself?). Ok, I think I got it.
The client is the docker command installed into OS X. The host is the Boot2Docker VM. The daemon is a background service running inside Boot2Docker. This variable tells the client how to connect to the daemon. When starting Boot2Docker, the terminal window that pops up already has DOCKERHOST set, so that's why docker commands work.
However, to run Docker commands in other terminal windows, you need to set this variable in those windows. Failing to set it gives a message like this: $ docker run hello-world 2014/08/11 11:41:42 Post dial unix /var/run/docker.sock: no such file or directory One way to fix that would be to simply do this: $ export DOCKERHOST=tcp://192.168.59.103:2375 But, as pointed out by others, it's better to do this: $ $(boot2docker shellinit) $ docker run hello-world Hello from Docker. To spell out this possibly non-intuitive Bash command, running boot2docker shellinit returns a set of Bash commands that set environment variables: export DOCKERHOST=tcp://192.168.59.103:2376 export DOCKERCERTPATH=/Users/ddavison/.boot2docker/certs/boot2docker-vm export DOCKERTLSVERIFY=1 Hence running $(boot2docker shellinit) generates those commands, and then runs them. It points to the docker host!
I followed these steps: $ boot2docker start Waiting for VM and Docker daemon to start. To connect the Docker client to the Docker daemon, please set: export DOCKERHOST=tcp://192.168.59.103:2375 $ export DOCKERHOST=tcp://192.168.59.103:2375 $ docker run ubuntu:14.04 /bin/echo 'Hello world' Unable to find image 'ubuntu:14.04' locally Pulling repository ubuntu 9cbaf023786c: Download complete 511136ea3c5a: Download complete 97fd97495e49: Download complete 2dcbbf65536c: Download complete 6a459d727ebb: Download complete 8f321fc43180: Download complete 03db2b23cf03: Download complete Hello world See.