# 查看新的Docker镜像 # docker images REPOSITORY TAG IMAGE ID CREATED SIZE peter/centos 1.1 8544847124e9 3 minutes ago 385MB centos latest 1e1148e4cc2c 6 weeks ago 202MB
# 查看新Docker镜像的构建历史 # dockerhistory peter/centos:1.1 IMAGE CREATED CREATED BY SIZE COMMENT 90fed978ec5c 2 hours ago /bin/sh -c#(nop) CMD ["/bin/sh" "-c" "/bin… 0B b5647b33ffb8 2 hours ago /bin/sh -c#(nop) EXPOSE 80 0B 3c621d86e6de 2 hours ago /bin/sh -c yum -y install vim net-tools 79.5MB a83741b44f7b 2 hours ago /bin/sh -c yum -y update 104MB a158527938a7 2 hours ago /bin/sh -c#(nop) WORKDIR /usr/local 0B 52f1709ed735 2 hours ago /bin/sh -c#(nop) ENV work_path=/usr/local 0B 058e53021a24 2 hours ago /bin/sh -c#(nop) MAINTAINER peter<peter@gm… 0B 1e1148e4cc2c 6 weeks ago /bin/sh -c#(nop) CMD ["/bin/bash"] 0B <missing> 6 weeks ago /bin/sh -c#(nop) LABEL org.label-schema.sc… 0B <missing> 6 weeks ago /bin/sh -c#(nop) ADD file:6f877549795f4798a… 202MB
以交互方式运行新构建的 Docker 镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 以交互式运行新的Docker镜像 # docker run -it --name="peter-centos" peter/centos:1.1
# 退出终端(不停止容器) # ctrl + p + q
# 查看当前所有正在运行的Docker容器 # docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b1a8c8ac1efc peter/centos:1.1 "/bin/sh -c /bin/bash" 2 minutes ago Up 2 minutes 80/tcp peter-centos