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

Docker container operation

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

Share

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

Docker container

Similar to a lightweight sandbox (because Docker is a virtual technology based on the Linux kernel, it consumes very few resources), Docker uses containers to run and isolate applications.

Containers run instances from applications created from images, which can be started, started, stopped, and deleted, and these containers are isolated and invisible to each other.

Think of each container as a simple version of the Linux system environment (including root user rights, process space, user space, and cyberspace), and an application box packaged with the applications running in it.

The mirror itself is read-only. When the container boots from the image, Docker creates a writeable layer at the top of the image, and the image itself remains the same. It's like ISO hasn't changed much since you installed the system with ISO.

Docker container related operations 1. Create a container

Docker create-it nginx / bin/bash # Container creation

Docker ps-a # View

two。 Container View

Docker ps-a # View all

3. Container startup and shutdown

Docker start 7564a08a0005 # launch Container

Docker run nginx / bin/bash-c ls / # start the execution command to view the system root directory

Note: the direct shutdown status of the previous command is Exited.

Continue to execute in the background

Docker run-d nginx / bin/bash-c "while true;do echo hello;done"

Docker ps

Note: docker run is equal to the execution of docker create and the execution of docker start. That is to say: if you check the image when creating a container using docker run, if there is no image, it will be downloaded from the public repository, and then create the container and run the container.

Web page validation:

Close the container

Docker stop 7564a08a0005

4. Delete Container

Docker rm 7564a08a0005

Docker ps-a

Note: stop the container before deleting it. If you want to add-f for mandatory deletion, it is recommended to stop before deleting it.

5. Entry of containers

Docker start 7564a08a0005 # Container entry (must be running)

Docker exec-it 7564a08a0005 / bin/bash

Exit / / exit the container

6. Import and export of containers

Container export

Docker export 7564a08a0005 > nginx

Container import

Docker import nginx ngin:nginxs # Import file name to generate image name nginx: label nginxs

Docker images

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