The basic operation of Docker container is fine! ! ! !

1. Create a container

docker create -it centos:7 /binbash
-i:让容器的标准输入保持打开
-t:让Docker分配一个伪终端

Insert picture description here

2. View the running status of the container

docker ps [选项]
-a:列出所有容器,包含未运行的容器。

Insert picture description here

3. Open the container

docker start [容器id]

Insert picture description here

4. Enter the container

docker exec  -it [id] /bin/bash

Insert picture description here

5. Start the execution command to view the system root directory

docker run centos:7 /bin/bash -c ls /

Insert picture description here

  • After this command is executed, the container will be created automatically, and the container will be closed after exiting

Insert picture description here

6. Terminate operation

docker stop [id]

Insert picture description here

7, delete the container

docker rm [id]

Insert picture description here

8. Container export

docker export 343f4787aa0c > nginx__a

Insert picture description here

9, container import

cat nginx__a | docker import - nginx:ru

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51614581/article/details/115125480