You can install Docker on Mac using Homebrew using the following command in the terminal program. You may be prompted to enter your password during the installation. It will take a minute or two to complete depending on your internet speed.
You can download this article as a PDF
Docker is a great way to have a consistent environment for your projects.
brew install docker --cask
Note: Because docker is a system-level package, you must install it using the --cask parameter.
Additional tools that you may also install
brew install bash-completion
brew install docker-completion
brew install docker-compose-completion
You may get this error: docker: Cannot connect to the Docker daemon at unix:///Users/user/.docker/run/docker.sock. Is the docker daemon running?.
Start the docker program (Docker Desktop)
you can use this command line
open /Applications/Docker.app
or you can search it in the apps. The docker icon should look like this.

After you start the program, you can run commands in the terminal.
Check the docker version
docker --version
Docker version 27.1.1, build 6312585
Run hello world container
docker run hello-world
you should see an output like this.
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
If you see an output like this that means that you've installed Docker on Mac successfully.
Related Links
- https://stackoverflow.com/questions/40523307/brew-install-docker-does-not-include-docker-engine
- https://stackoverflow.com/questions/44084846/cannot-connect-to-the-docker-daemon-on-macos