(三)docker之容器管理
程序员文章站
2024-03-11 19:30:43
...
1.查看所有正在运行的容器
[[email protected] /]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bbdc5077e2e1 6a8b22d5dc8b "/bin/bash" About a minute ago Up About a minute test01
c8dc8e910ad7 centos:latest "/bin/bash" 6 hours ago Up 6 hours quirky_shannon
2.启动容器
[[email protected] /]# docker container run -it --name test01 6a8b22d5dc8b /bin/bash
[[email protected] /]#
注意:docker端口映射和项目挂载,命令为
[[email protected] /]# docker container run -it -p 8080:80 -v /data/wwwroot/default/api:/api 6a8b22d5dc8b /bin/bash
[[email protected] /]#
3.停止容器
[[email protected] /]# docker stop bbdc5077e2e1
bbdc5077e2e1
4.删除容器
[[email protected] /]# docker rm bbdc5077e2e1
bbdc5077e2e1
提示:推出容器使用 ctrl+P+Q