English 日本語
INTERSTELLAR TECH BLOG

Installing Docker on a Mac with Homebrew

Hi, I am Agata.

This time it is how to install Docker with Homebrew on a Mac.
I’m leaving this as a note because many old articles are found when searching, and they are different from the current situation.

Prerequisite

Since the situation is changing rapidly, I’ll write down the assumptions: as of March 14, 2022, the Homebrew version is as follows.

% brew --version
Homebrew 3.4.1
Homebrew/homebrew-core (git revision 0a6a95da043; last commit 2022-03-14)
Homebrew/homebrew-cask (git revision dd38743d4e; last commit 2022-03-14)

Install

Install the GUI application with the following command.
There seems to be a separate command line package, but even if you install the GUI app (Docker Desktop), the command line tool will be installed, so unless you have a special reason, you should just use the GUI one.

% brew install --cask docker

The command will install the following, which may take a little time to download due to the large size of the GUI application.

Running `brew update --preinstall`...
==> Downloading https://desktop.docker.com/mac/main/amd64/74594/Docker.dmg
Already downloaded: /Volumes/ExternalSSD/Users/agata/Library/Caches/Homebrew/downloads/85d80b9c62f4c5b1c30d51afc0854ad1b15693a99170d661aef8f17140085bb0--Docker.dmg
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker-compose.bash-completion' to '/usr/local/etc/bash_completion.d/docker-compose'
==> Linking Binary 'docker.zsh-completion' to '/usr/local/share/zsh/site-functions/_docker'
==> Linking Binary 'docker.fish-completion' to '/usr/local/share/fish/vendor_completions.d/docker.fish'
==> Linking Binary 'docker-compose.fish-completion' to '/usr/local/share/fish/vendor_completions.d/docker-compose.fish'
==> Linking Binary 'docker-compose.zsh-completion' to '/usr/local/share/zsh/site-functions/_docker_compose'
==> Linking Binary 'docker.bash-completion' to '/usr/local/etc/bash_completion.d/docker'
🍺  docker was successfully installed!

After installation, launch the application with the following command or from the Finder.

open /Applications/Docker.app 

Once started, you will be asked for your password, as setup requires administrator privileges.
When Docker Desktop starts, installation is complete.

At this point, the command line tool is also available. Go back to the terminal and check the version of the command line tool as well.

% docker --version
Docker version 20.10.12, build e91ed57
% docker-compose --version
docker-compose version 1.29.2, build 5becea4c