Mac OSX Docker shows “Cannot connect to the Docker daemon”


When running Docker you may experience the following error,

root# docker images
Cannot connect to the Docker daemon. Is the docker daemon running on this host?


To start the Docker daemon run the following commands.

docker-machine start default
eval ‘docker-machine env default’

Below is an example,

root# docker-machine start default
Starting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...

Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

root# eval 'docker-machine env default'

To ensure the Docker daemon is started each time you log in, add these commands to ~/.bash_profile
You can now confirm everything is working as expecting by issuing a Docker command, like so,

root# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Status: Image is up to date for busybox:latest
Rick Donato

Want to become a Docker and Kubernetes expert?

Here is our hand-picked selection of the best courses you can find online:
Docker Mastery course
Kubernetes Mastery course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial