Docker 容器管理:
docker create -it centos //这样可以创建一个容器,但该容器并没有启动:
docker start container_id //启动容器后,可以使用docker ps 查看到,有start 就有stop,和restart
前台启动docker容器:
docker run -it linux123 /bin/bash
docker:/root# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b8e15e36e3ec linux123 "/bin/bash" 10 seconds ago Up 8 seconds furious_carson
docker:/root# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b8e15e36e3ec linux123 "/bin/bash" 2 minutes ago Exited (0) 10 seconds ago furious_carson
后台运行docker:
docker run -itd linux123 /bin/bash
进入容器:
docker:/root# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf329e96109d centos_6.5:zjzc "/bin/bash" 32 minutes ago Up 32 minutes kickass_pasteur
382cdd674040 centos_6.5_net:scan "/bin/bash" 40 minutes ago Up 40 minutes nostalgic_fermi
ec430386e30c centos-6-x86-template:zjzc "/bin/bash" 58 minutes ago Up 58 minutes hungry_pare
c0895b3b9477 blalor/centos "/bin/bash" 19 hours ago Up 19 hours loving_meitner
40d30fb0fc60 blalor/centos "/bin/bash" 19 hours ago Up 19 hours admiring_cray
c0dfbb37f841 centos "/bin/bash" 20 hours ago Up 20 hours fervent_ardinghelli
docker:/root# docker exec -it cf329e96109d /bin/bash