后台启动tomcat
-p 主机端口:容器端口
[root@Proxy ~]# docker run -p 8888:8080 -d tomcat
573544636c96ca5f30780ce0f67551f6f89e337687b348c15f669a92b189bd1e
查看容器
[root@Proxy ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
063704b0a54b tomcat "catalina.sh run" 7 minutes ago Up 7 minutes 0.0.0.0:8080->8080/tcp tomcat
删除容器
[root@Proxy ~]# docker rm -f 063704b0a54b
063704b0a54b
停止容器
[root@Proxy ~]# docker stop 063704b0a54b
063704b0a54b
容器的启动和重启
[root@Proxy ~]# docker start 063704b0a54b
063704b0a54b
[root@Proxy ~]# docker restart 063704b0a54b
063704b0a54b
进入容器
[root@Proxy ~]# docker exec -it 063704b0a54b /bin/bash
root@063704b0a54b:/usr/local/tomcat#
删除所有已停止的容器
[root@Proxy ~]# docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y