docker history myimage:latest
IMAGE CREATED CREATED BY SIZE COMMENT
sha256:123abc456def 2 days ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon… 0B
sha256:789ghi012jkl 2 days ago /bin/sh -c #(nop) COPY file:abc123 in /var/… 1.5kB
sha256:345mno678pqr 2 days ago /bin/sh -c apt-get update && apt-get install… 45.3MB
sha256:678stu901vwx 2 days ago /bin/sh -c #(nop) LABEL maintainer=yourname… 0B
sha256:901yza234bcd 2 days ago /bin/sh -c #(nop) FROM ubuntu:20.04 72.9MB
docker history --no-trunc myimage:latest
docker history -q myimage:latest
sha256:123abc456def
sha256:789ghi012jkl
sha256:345mno678pqr
sha256:678stu901vwx
sha256:901yza234bcd
# 使用 Ubuntu 作为基础镜像
FROM ubuntu:20.04
# 添加维护者信息
LABEL maintainer="yourname@example.com"
# 更新包列表并安装 Nginx
RUN apt-get update && apt-get install -y nginx
# 复制自定义网页到 Nginx 的默认网页目录
COPY index.html /var/www/html/
# 设置启动时的默认命令
CMD ["nginx", "-g", "daemon off;"]
docker build -t mynginx:latest .
docker history mynginx:latest
IMAGE CREATED CREATED BY SIZE COMMENT
sha256:123abc456def 1 minute ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon… 0B
sha256:789ghi012jkl 1 minute ago /bin/sh -c #(nop) COPY file:abc123 in /var/… 1.5kB
sha256:345mno678pqr 1 minute ago /bin/sh -c apt-get update && apt-get install… 45.3MB
sha256:678stu901vwx 1 minute ago /bin/sh -c #(nop) LABEL maintainer=yourname… 0B
sha256:901yza234bcd 1 minute ago /bin/sh -c #(nop) FROM ubuntu:20.04