docker_practice/install/mac.md

79 lines
2.7 KiB
Go
Raw Normal View History

2020-10-26 07:26:51 +00:00
## Install Docker Desktop CE on maxOS
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
### OS Requirement
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
The minimum OS version requirement [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/) is macOS El Capitan 10.11.
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
### Installation
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
#### Install with Homebrew
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
The [Cask](https://caskroom.github.io/) of [Homebrew](https://brew.sh/) has already supported Docker Desktop for Mac, so we can instrall it with Homebrew Cask easily.
```bash
2017-11-22 12:28:10 +00:00
$ brew cask install docker
```
2020-10-26 07:26:51 +00:00
#### Download and Install Manually
2020-10-26 07:26:51 +00:00
If you need to download `Docker Desktop for Mac` manually, please click the [Stable](https://download.docker.com/mac/stable/Docker.dmg) or [Edge](https://download.docker.com/mac/edge/Docker.dmg) link to downlaod it.
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
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](https://blog.docker.com/2013/10/call-me-moby-dock/)) icon to the `Applications` folder. During the process, you will be prompted to enter your password for your mac.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-dmg.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
### Run
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
Find the Docker icon from your applications, and double click the icon to run Docker Desktop.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-apps.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
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.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-menubar.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
For the first time clicking on the icon, you may see the successful installation window. Clicking on "Got it!" will close the window.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-success.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
Clicking on the whale icon each time afterwards will show you the operation menu.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-menu.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
After opening the terminal, you can check the newly-installed Docker version with commands.
2016-11-11 18:47:24 +00:00
```bash
$ docker --version
Docker version 19.03.1, build 74b1e89
2016-11-11 18:47:24 +00:00
$ docker-compose --version
docker-compose version 1.24.1, build 4667896b
2016-11-11 18:47:24 +00:00
$ docker-machine --version
docker-machine version 0.16.1, build cce350d7
2016-11-11 18:47:24 +00:00
```
2020-10-26 07:26:51 +00:00
If `docker version` and `docker info` shows no error nor warning, you can try to run an [Nginx Server](https://hub.docker.com/_/nginx/).
2016-11-11 18:47:24 +00:00
```bash
$ docker run -d -p 80:80 --name webserver nginx
```
2020-10-26 07:26:51 +00:00
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.
2016-11-11 18:47:24 +00:00
2017-11-30 07:57:27 +00:00
![](_images/install-mac-example-nginx.png)
2016-11-11 18:47:24 +00:00
2020-10-26 07:26:51 +00:00
To stop the Nginx server and delete it, you can execute the following commands:
2016-11-11 18:47:24 +00:00
```bash
$ docker stop webserver
$ docker rm webserver
```
2017-09-04 03:17:56 +00:00
2020-10-26 07:26:51 +00:00
### Registry Mirror(In China)
2017-09-04 03:17:56 +00:00
2020-10-26 07:26:51 +00:00
If you pull docker images very slowly, then you can configure [Registry Mirror](mirror.md).
2020-10-26 07:26:51 +00:00
### References
2020-10-26 07:26:51 +00:00
* [Official Document](https://docs.docker.com/docker-for-mac/install/)