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 virtualize docker

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to virtualize docker. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The content of a picture at the beginning depends on compilation.

Simple and clear description of the docker startup process, like to remember the collection ah!

Next, let's compare the docker with the traditional virtual machine. A picture will be clearer.

This is the explanation under centos7.

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

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

2. Enable docker

/ bin/systemctl start docker.service

3. Search the application image

Docker search nginx== image name

4. Download the image

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 nginx above to centos

Specify the directory under which to mount, and-v is the specified directory to mount.

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

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

Then add this to the top of the nginx.conf

9. Submit the image

Start mirroring

/ usr/local/sbin/nginx connect to the top.

10. Create an image using dockerfile

And then run this in the directory.

11. Explanation of mirror nouns and notes for downloading

(1) docker images-an or docker images-qa lists all images-Q shows only id

12. Create a centos and enter the virtual centos

-I means to interact.-t means to have an interactive terminal.

Id of the docker run-it container

To verify whether it is successful, we need to execute docker ps to view the container process under your previous linux command line window

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

Two ways for us to exit the container

Delete multiple containers

13. How the docker daemon starts

If you don't want to be inside the container and you want to back out, then you write a script to loop out and keep the interaction.

14. When we start a container with a daemon and we want to enter it again, we need to do this

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

(2) docker attach f2095f5b5360

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

16. Interactive backup of the image from docker and the original host data, and data sharing between the host and the docker virtual host

With ro, you can only read but not write, that is, the two can synchronize the data, but the virtual host cannot modify the data synchronized by the host.

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

Thank you for reading! This is the end of the article on "how to virtualize docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Internet Technology

Wechat

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

12
Report