docker_practice/install/mac.md

2.7 KiB

Install Docker Desktop CE on maxOS

OS Requirement

The minimum OS version requirement Docker Desktop for Mac is macOS El Capitan 10.11.

Installation

Install with Homebrew

The Cask of Homebrew has already supported Docker Desktop for Mac, so we can instrall it with Homebrew Cask easily.

$ brew cask install docker

Download and Install Manually

If you need to download Docker Desktop for Mac manually, please click the Stable or Edge link to downlaod it.

Just as other softwares on macOS, the installation of Docker Desktop for macOS is easy. You only need to double click the .dmg file, and then drag the whale(Moby) icon to the Applications folder. During the process, you will be prompted to enter your password for your mac.

Run

Find the Docker icon from your applications, and double click the icon to run Docker Desktop.

After running, there should be a whale icon on the top right bar of your mac desktop. This icon indicates the running status of Docker.

For the first time clicking on the icon, you may see the successful installation window. Clicking on "Got it!" will close the window.

Clicking on the whale icon each time afterwards will show you the operation menu.

After opening the terminal, you can check the newly-installed Docker version with commands.

$ docker --version
Docker version 19.03.1, build 74b1e89
$ docker-compose --version
docker-compose version 1.24.1, build 4667896b
$ docker-machine --version
docker-machine version 0.16.1, build cce350d7

If docker version and docker info shows no error nor warning, you can try to run an Nginx Server.

$ docker run -d -p 80:80 --name webserver nginx

When the sever is up and running, you can visit http://localhost, if you see "Welcome to nginx!", it means the installation of Docker Desktop for macOS is successful.

To stop the Nginx server and delete it, you can execute the following commands:

$ docker stop webserver
$ docker rm webserver

Registry Mirror(In China)

If you pull docker images very slowly, then you can configure Registry Mirror.

References