Container management

1, create a container, but it did not start
docker create -it centos bash

2, the container initiates the creation of
docker ps -a // View Id
Docker Start the above mentioned id (Docker Start b19395cf7b71)
Container management

3, into the container
docker run -it centos_nettools bash
use the command to exit the exit or ctrl d bash, when the exit the container will stop.

4, the vessel is custom name
docker run --name web -itd centos bash // --name name to the custom container
Container management

5, the container exit delete
docker run --rm -it centos bash -c " sleep 30"

--rm allows container delete exit, where the container will be executing the command quit!

6. Check the container historical operating information
docker logs id or name

Container management

7, may temporarily open a virtual terminal, and after the exit, the vessel still running

docker exec -it 31b3b00875be bash
Container management

8, derived container, can be moved to other machines, need to import
docker ps
docker export id > filename.tar(31b3b00875be > docker export contos.tar
Container management

Guess you like

Origin blog.51cto.com/10690709/2429880