The growth path of virtualized docker

The growth path of virtualized docker

The content of a picture of the opening depends on editing

A simple and clear explanation of the startup process of docker, remember to collect it if you like it!

Next, let's compare the comparison between docker and traditional virtual machine, a picture will be clearer

This time it is explained under centos7

1. Download a file to install docker, and then install the sh file

wget -qo- https://get.docker.com/| sh

2. Turn on docker

/bin/systemctl start docker.service

3. Search for application mirroring

docker search nginx==image name

4. Download the mirror

docker pull linuxserver/nginx==image name

5. Port mapping

6.

7. Start a nginx container, --name is the name of the current container

Change the above nginx to centos

Specify the directory under which to mount, -v is the directory to be mounted

8. Modify the startup configuration file to start linux and then start nginx

First modify this file and add a command to start nginx, such as/usr/local/sbin/nginx

Then add this to the top of nginx.conf

9. Submit mirror

Boot mirror

/usr/local/sbin/nginx connect to the above

10. Use dockerfile to create a mirror

Then run this in the directory

11. Explanation of mirroring terms and precautions for download

(1) docker images -a or docker images -qa lists all mirrors -q only displays id

12. Create a centos and enter this virtual centos

-i means to interact -t means to have an interactive terminal

docker run -it container id

To verify success, we need to execute docker ps under your original linux command line window to view the process of the container

We can add some of the following parameters, such as docker ps -a

Two ways we exit the container

Delete multiple containers

13, the way the docker daemon is started

If you don’t want to be inside the container, and you want to exit, then you write a script to loop the output and keep the interaction

14. When we start a container as a daemon, if we want to enter again, we need to execute it like this

(1) docker exec -it f2095f5b5360/bin/bash

(2) docker attach f2095f5b5360

15. Copy the files in docker to where you need it

16. Docker image and original host data interactive backup, data sharing between host and docker virtual host

Adding ro means that it can only be read but not written, that is, the two can synchronize data, but the virtual host cannot modify the data synchronized by the host

Application scenarios, for example, I have uploaded the code on the host, and then I use docker to directly synchronize to the virtual host, and then I can directly access

Reference: https://cloud.tencent.com/developer/article/1562181 The growth path of virtualized docker-Cloud + Community-Tencent Cloud