Docker 容器管理:
docker create -it centos //这样可以创建一个容器,但该容器并没有启动:
create Create a new container 创建一个容器:
docker:/root# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
38deed33103b 192.168.32.150:5000/zjzc_centos6.5_app "bash" 3 months ago Up About a minute zjtest8_app01
后台运行docker: run Run a command in a new container
在一个新的容器里运行一个命令
docker run 创建一个新的容器
docker:/root# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
38deed33103b 192.168.32.150:5000/zjzc_centos6.5_app "bash" 3 months ago Up 5 minutes zjtest8_app01
docker:/root# docker run -itd 192.168.32.150:5000/zjzc_centos6.5_haproxy /bin/bash
e0c7534aa977b2488efe4daf64f497fa6848fe6f4acb212f37dca692181285fc
docker:/root# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e0c7534aa977 192.168.32.150:5000/zjzc_centos6.5_haproxy "/bin/bash" 3 seconds ago Up 1 seconds boring_stallman
38deed33103b 192.168.32.150:5000/zjzc_centos6.5_app "bash" 3 months ago Up 5 minutes zjtest8_app01
docker:/root# docker exec -it e0c7534aa977 bash 执行命令