1、create 创建
[root@localhost ~]# docker create tomcat
2、查看所有运行的镜像 -a 显示所有状态的镜像
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b48c541a3112 tomcat "catalina.sh run" 24 seconds ago Created vibrant_mah
3、start 在后台运行(b48c541a3112是上面的CONTAINER ID )
[root@localhost ~]# docker start b48c541a3112
b48c541a3112
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b48c541a3112 tomcat "catalina.sh run" 5 minutes ago Up 3 seconds 8080/tcp vibrant_mahavira
4、pause 暂停
[root@localhost ~]# docker pause b48c541a3112
b48c541a3112
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b48c541a3112 tomcat "catalina.sh run" 7 minutes ago Up 2 minutes (Paused) 8080/tcp vibrant_ma
5、unpause 恢复
[root@localhost ~]# docker unpause b48c541a3112
b48c541a3112
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b48c541a3112 tomcat "catalina.sh run" 8 minutes ago Up 3 minutes 8080/tcp vibrant_ma
6、停止,可以用start命令重新启动
[root@localhost ~]# docker stop b48c541a3112
b48c541a3112
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b48c541a3112 tomcat "catalina.sh run" 10 minutes ago Exited (143) 5 seconds ago vibrant_
7、删除(强制删除)
docker rm -f b48c541a3112