查看容器id
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ed38309b8e26 ubuntu:14.04 "/bin/bash" 21 minutes ago Exited (0) 1 second ago hopeful_heisenberg
哦,状态为Exited 让我们来启动容器:
# docker start ed38309b8e26
ed38309b8e26
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ed38309b8e26 ubuntu:14.04 "/bin/bash" 27 minutes ago Up 4 seconds hopeful_heisenberg
进入容器3种方法:
1、docker-enter ed38309b8e26 /bin/bash
2、docker attach ed38309b8e26 敲下回车
3、docker exec -ti ed38309b8e26 /bin/bash