Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use docker on mac

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to install and use docker on mac". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and use docker on mac.

Let's look at the installation and use of a simple docker on mac.

1. Download DockerToolbox installation

2. Docker Quickstart Terminal can enter docker command or docker-machine ssh default can enter docker virtual machine

3 、 docker ps

4 、 docker images

5. The combination of case mysql and wordpress

A, docker run-d-p 3306 MYSQL_ROOT_PASSWORD=123456 mysql 3306-v / mnt/sda1/volumes/mysql:/var/lib/mysql-- name mysql-e MYSQL_ROOT_PASSWORD=123456 mysql

B, docker run-d-p 8080 link mysql:mysql wordpress 80-- name wordpress--

C, run 192.168.99.100rig 8080 to open a newly installed blog site.

The above is just a simple case, to run a blog site, is not very simple. Where 192.168.99.100 is the virtual machine ip, as the case may be.

Well, we still need to understand some concepts.

1. What is an image:

The image contains the structure and content of the file system needed to start the container, which is a complete package of the container's running environment.

2. What is a container:

When the image is started, the container is generated.

3. How to generate an image:

Write a Dockerfile file and generate it through the docker build command.

4. What is a Dockerfile file:

Dockerfile describes the steps to assemble an image, where each instruction is executed individually, and Docker creates an image with all the configuration information and executable commands in the Dockerfile file. Instructions in Dockerfile are case-insensitive, but they are generally uppercase, mainly distinguished from the parameters of the instruction. Dcoker executes the identified instructions. The first instruction must be 'FROM', to specify which underlying image the current image is based on.

5. What is a data volume:

When you create a new container, you can mount a specific directory on a host to the container. When the container is started, if the directory exists, the contents of the directory will be copied to the folder corresponding to the host. When the directory data in the container changes, it will be copied to the host in real time, and they will synchronize the real-time data with each other, so that the data will not be lost each time the container is restarted.

This directory must be an absolute path, and if it does not exist in the host, an empty folder will be created. You can also mount a single file into a container.

6. How to push and pull the image, let's take the pulse cloud image warehouse as an example:

1) Log in to Pulse Cloud Image Repository:

Docker login maichong.io

Enter and enter the user name and password as prompted

2) pull the image:

Docker pull image address

3) push image

Docker push image address

At this point, I believe you have a deeper understanding of "how to install and use docker on mac". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report