This article is reproduced from https://www.cnblogs.com/yu-hailong/p/7629130.html
Only for self-collection and learning, not for commercial and promotional purposes
System Requirements
Docker for Mac requires a minimum system of macOS 10.10.3 Yosemite, or a Mac model after 2010, to be precise with Intel MMU virtualization, and a minimum of 4GB of memory.
If your system does not meet your needs, you can install Docker Toolbox .
Install
Install with Homebrew
Homebrew 's Cask already supports Docker for Mac, so it's easy to use Homebrew Cask to install:
brew cask install docker
Download and install manually
If you need to download manually, you can download it from this link: https://download.docker.com/mac/stable/Docker.dmg
Like other macOS software, installation is very simple, double-click the downloaded file, and then drag the whale icon .dmg
called MobyApplication
to the folder (the system password may be asked).
run
Find the Docker icon from the app and click Run.
After running, you will see an additional whale icon in the upper right menu bar, which indicates the running status of Docker.
The first time you click the icon, you may see the successful installation interface. Click "Got it!" to close this window.
Each time you click the whale icon in the future, an action menu will pop up.
If you use Docker in China, you need to configure the accelerator, click on the menu Preferences...
, and then view Advanced
the label, in which Registry mirrors
you can click the plus sign to add the accelerator address.
After starting the terminal, you can check the installed Docker version with the command
1 $ docker --version 2 Docker version 1.12.3, build 6b644ec 3 $ docker-compose --version 4 docker-compose version 1.8.1, build 878cff1 5 $ docker-machine --version 6 docker-machine version 0.8.2, build e18a919
If everything works fine docker version
, docker info
you can run an Nginx server :
1 $ docker run -d -p 80:80 --name webserver nginx
After the service is running, you can visit http://localhost . If you see "Welcome to nginx!", it means that Docker for Mac has been successfully installed.
To stop the Nginx server and delete it execute the following command:
1 $ docker stop webserver 2 $ docker rm webserver