Docker containers have, without a doubt, revolutionized the way we develop and deploy our applications. They provide developers with the ability to package applications and dependencies in an isolated environment.
We have seen widespread adoption of Docker as the ultimate containerization platform in the recent past. Due to this, setting up Docker across all platforms has incredibly been simplified, including macOS and Windows.
Use Homebrew to Install Docker in macOS
Docker supports the most recent versions of macOS, including macOS Big Sur, macOS Monterey, and macOS Catalina. Docker offers a native application that we can install under the
Applications directory and create symlinks in
Use Homebrew to install Docker. It’s an open-source software package management system that we can use to install applications on macOS.
Homebrew installs packages to their directory and then symlinks their files into
/usr/local. Homebrew can be installed by running the command below in the terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now that Homebrew is installed to install Docker, execute the below command.
brew cask install docker
This command will download the
docker package, run the Docker installer, and open the GUI to set up configurations. Use the command below to verify the installation was successful.
As mentioned before, Homebrew installs packages to their directory and then symlinks their files into
/usr/local (on macOS Intel). However, after Brew has installed Docker, the docker command (symbolic link) may not be available at
To resolve this, follow the following steps.
Press ⌘+Space to open
Spotlight Search, and enter
Dockerto launch Docker.
Docker needs privileged accessdialog box, click
Enter a password and click
Once we have launched Docker, a whale-like icon should now be visible in the status menu. This means that all the symbolic files pointing to the location of Docker have been properly set up in
You can confirm this by executing the command below in the terminal.
$ ls -l /usr/local/bin/docker*
Now click on the Docker icon and wait for Docker to start.
Finally, we will run the command below to test that your Docker installation is properly set up.
$ docker run hello-world
We have pulled the
hello-world image from the Docker registry and successfully created a Docker container with this command. This signifies that Docker is now properly set up in your system.