Basic operation of Docker container
1. Create a container
docker create -it centos:7 /binbash
-i:让容器的标准输入保持打开
-t:让Docker分配一个伪终端
2. View the running status of the container
docker ps [选项]
-a:列出所有容器,包含未运行的容器。
3. Open the container
docker start [容器id]
4. Enter the container
docker exec -it [id] /bin/bash
5. Start the execution command to view the system root directory
docker run centos:7 /bin/bash -c ls /
- After this command is executed, the container will be created automatically, and the container will be closed after exiting
6. Terminate operation
docker stop [id]
7, delete the container
docker rm [id]
8. Container export
docker export 343f4787aa0c > nginx__a
9, container import
cat nginx__a | docker import - nginx:ru