命令:
docker history 镜像id
[root@localhost docker-files]# ls
apisix1_dockerfile centos_dockerfile entrypoint.sh
[root@localhost docker-files]# cat centos_dockerfile
FROM centos:7
MAINTAINER yangyue<= <yangyue@yangyue.cn>
RUN yum install -y vim
WORKDIR /usr
cmd /bin/bash
[root@localhost docker-files]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@localhost docker-files]# docker build -f ./centos_dockerfile -t centostest1:1 .
Sending build context to Docker daemon 4.608 kB
Step 1/5 : FROM centos:7
---> eeb6ee3f44bd
Step 2/5 : MAINTAINER yangyue<= <yangyue@yangyue.cn>
---> Using cache
---> 66086d8a9f63
Step 3/5 : RUN yum install -y vim
---> Using cache
---> b7a971570078
Step 4/5 : WORKDIR /usr
---> Using cache
---> 1d844be7b22e
Step 5/5 : CMD /bin/bash
---> Using cache
---> 19f1820de286
Successfully built 19f1820de286
[root@localhost docker-files]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centostest1 1 19f1820de286 21 hours ago 408 MB
[root@localhost docker-files]# docker history 19f1820de286
IMAGE CREATED CREATED BY SIZE COMMENT
19f1820de286 21 hours ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "/b... 0 B
1d844be7b22e 21 hours ago /bin/sh -c #(nop) WORKDIR /usr 0 B
b7a971570078 21 hours ago /bin/sh -c yum install -y vim 204 MB
66086d8a9f63 21 hours ago /bin/sh -c #(nop) MAINTAINER yangyue<= <y... 0 B
eeb6ee3f44bd 3 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
<missing> 3 months ago /bin/sh -c #(nop) LABEL org.label-schema.... 0 B
<missing> 3 months ago /bin/sh -c #(nop) ADD file:b3ebbe8bd304723... 204 MB
[root@localhost docker-files]#
查看详细信息:
docker history --format {{.CreatedBy}} --no-trunc=true 镜像id |sed "s/\/bin\/sh\ -c\ \#(nop)\ //g"|sed "s/\/bin\/sh\ -c/RUN/g" | tac
root@bjali-ecs-172-16-192-65:/home/op# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> fb12486a9093 21 hours ago
apache/apisix 2.10.0-alpine 627d00c649fc 2 months ago 110MB
root@XX:/home/op# docker history --format {{.CreatedBy}} --no-trunc=true 627d00c649fc|sed "s/\/bin\/sh\ -c\ \#(nop)\ //g"|sed "s/\/bin\/sh\ -c/RUN/g" | tac
ADD file:ecdfb91a737d6c292265c1b77ffd3d82ba810dd43ea4ef79714b66b1da74a5aa in /
CMD ["/bin/sh"]
ARG ENABLE_PROXY
RUN |1 ENABLE_PROXY=false RUN set -x && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) && apk add --no-cache bash libstdc++ curl tzdata # buildkit
WORKDIR /usr/local/apisix
COPY /usr/local/openresty/ /usr/local/openresty/ # buildkit
COPY /usr/local/apisix/ /usr/local/apisix/ # buildkit
COPY /usr/bin/apisix /usr/bin/apisix # buildkit
RUN |1 ENABLE_PROXY=false RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log && ln -sf /dev/stderr /usr/local/apisix/logs/error.log # buildkit
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
EXPOSE map[9080/tcp:{} 9443/tcp:{}]
CMD ["sh" "-c" "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]
STOPSIGNAL SIGQUIT
root@XX:/home/op# ls