Dock常用命令
12
# 创建容器docker run --name NAME -v /HOST:/CONTAINER -p 8081:80 -d IMAGE:latest
--name NAME
-v /HOST:/CONTAINER
-p 8081:80
-d
IMAGE:latest
123456789101112131415
# 查看容器docker ps -a# 删除容器docker rm CONTAINERID# 启动容器docker start CONTAINERIDdocker start NAME# 关闭容器docker stop CONTAINERIDdocker stop NAME# 连接到容器上运行bashdocker exec -ti CONTAINERID /bin/bash# 查看容器内部的标准输出docker logs -f CONTAINERIDdocker logs -f NAME
123456789101112
# 根据容器创建镜像docker commit -m "描述信息" -a "作者" CONTAINERID IMAGE:v1# 从零开始构建镜像docker build -t IMAGE:v1 .# 查看镜像docker images# 删除镜像docker rmi IMAGEID# 查看端口映射docker port CONTAINERIDdocker port NAME