brew install docker gives a docker command but no engine on macOS
Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?Short answer
On macOS the Homebrew docker formula installs the command line client only. Docker Engine is a Linux daemon, and on a Mac it ships inside Docker Desktop. With only the client, every command fails to reach a daemon. Install Docker Desktop, or install Colima and run colima start, so a daemon exists.
Fix it fast
1Find out which cause you have
Print the client and server parts of the version. If the Server section is missing or errors, there is no daemon to talk to.
docker version2Match what you see, then jump to its fix
- 1
docker version shows a Client block and an error where the Server block should beOnly the client is installedFix - 2
Same error after a reboot, though the install worked beforeColima or Docker Desktop is installed but not startedFix - 3
DOCKER_HOST is set, or DOCKER_CONTEXT names a runtime that is stoppedThe client points at another daemonFix
- 1
What does the error look like?
Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?
Cause 1 of 3
Only the client is installed
1Check
Docker's install docs list Docker Engine for Windows and macOS only through Docker Desktop. The Homebrew formula is described as the Docker tool itself; it does not bring a daemon.
which docker && ls /Applications | grep -i docker2Fix
Install a runtime. Option one: Docker Desktop from Docker's download page, open Docker.app and accept the agreement. Option two: Colima, which Homebrew provides, then start it.
brew install colima
colima start3Verify
docker version now prints a Server section.
docker run --rm hello-worldConfirmed by docs.docker.com
Cause 2 of 3
Colima or Docker Desktop is installed but not started
1Check
Colima has to be running before the client works. Docker Desktop has to be opened once so its engine starts.
colima status2Fix
Start it.
colima start3Verify
Run any container.
docker psConfirmed by github.com
Cause 3 of 3
The client points at another daemon
1Check
The Docker docs name an unreachable remote host as the second cause, and describe the DOCKER_CONTEXT variable overriding the saved default.
env | grep DOCKER
docker context show2Fix
Unset a stray DOCKER_HOST or switch the context.
unset DOCKER_HOST
docker context use default3Verify
Run docker version again.
docker versionConfirmed by docs.docker.com
How do I stop it coming back?
- Pick one runtime on a Mac and remove the other from your startup items.
- Start the runtime before opening your editor's Docker extension.
- Remove old DOCKER_HOST lines from ~/.zshrc.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
The Mac terminal does not know the docker command
bash: docker: command not found
The shell cannot find a docker binary in any folder on PATH.
3 causes, each with a fixServers
The docker command cannot reach the Docker daemon
Cannot connect to the Docker daemon at unix:///Users/<user>/.docker/run/docker.sock. Is the docker daemon running?
This error means the docker client could not talk to a running daemon.
4 causes, each with a fixServers
apk cannot find py-pip in an Alpine Docker image
py-pip (no such package):
On current Alpine releases there is no package called py-pip.
2 causes, each with a fixServers
ng serve runs in the container but localhost:4200 does not open
The browser cannot open localhost:4200 although ng serve is running in the container
ng serve listens on localhost by default, which inside a container is the container itself.
3 causes, each with a fixServers
Angular routes return 404 from nginx when you refresh or open a link
The home page loads, but refreshing /some/route shows an nginx 404
Angular routes like /users/42 are not files, so nginx looks for them on disk and returns 404.
3 causes, each with a fixServers
AH00558: Apache in Docker cannot reliably determine its fully qualified domain name
Set the 'ServerName' directive globally to suppress this message
AH00558 is a warning, not a crash.
2 causes, each with a fix