MacOS Docker installation and basic use

MacOS can use Homebrew to install Docker

Homebrew Cask already supports Docker for Mac, so you can easily use Homebrew Cask to install:

Enter the command: brew cask install docker

image

The installation process is as shown in the figure above, and the 
prompt docker was successfully installed! finally appears when the docker installation is successful, and finally you can see the downloaded docker.app in the startup console, as shown in the figure below:

image

image

Find the Docker icon at the top and click Run. You are prompted to enter the macOS login password. After entering the password, you can enter the following page

image

Click the Start button to start the basic docker operation steps (lazy operation, just click the docker command on the left, the command line on the right will automatically enter the docker command and execute it)

 

Step001: Clone a Repository (Clone a Repository)

image

Command explanation:

docker run --name repo alpine/git clone https://github.com/docker/getting-started.git
clone a container named alpine from the official github website and start it, and rename the container to repo

 

docker cp repo:/git/getting-started/.
Copy the directory of /git/getting-started/ of the container repo to the. directory of the host

 

When the prompt shown below appears on the right command line

image

image

Then click Next Step to enter step two

 

Step002: build the image (create a mirror)

image

Command explanation:

cd getting-started
into the getting-started directory

docker build -t docker101tutorial.
Use the Dockerfile in the current directory to create a mirror, labeled docker101tutorial

Click Next Step to enter step three

 

Step003: run your container (run container)

image

Command explanation:

docker run -d -p 80:80 --name docker-tutorial docker101tutorial
Use the mirror docker101tutorial to start a container in background mode and name the container docker-tutorial, and map the container's port 80 to the host's port 80

Click Next Step to go to step four

 

Step004: save and share your image (save and share your image)

image

The docker command indicated by the arrow in the above figure is grayed out and is not allowed to be clicked. The reason is that to share the image, you need to log in to the Docker Hub official website to perform this operation.

Click the Done button in Step004 to enter the following interface, indicating that the basic steps of using docker have been completed on the MacOS system

image

Welcome to pay attention to [The Way of Infinite Testing] public account , reply [receive resources],
Python programming learning resources dry goods,
Python+Appium framework APP UI automation,
Python+Selenium framework Web UI automation,
Python+Unittest framework API automation,

Resources and codes are sent for free~
There is a QR code of the official account at the bottom of the article, you can just scan it on WeChat and follow it.

Remarks: My personal public account has been officially opened, dedicated to the sharing of test technology, including: big data testing, functional testing, test development, API interface automation, test operation and maintenance, UI automation testing, etc., WeChat search public account: "Infinite The Way of Testing", or scan the QR code below:

 Add attention and let us grow together!

Guess you like

Origin blog.csdn.net/weixin_41754309/article/details/112100278