一个经过验证的响应:它确实在最终图像中保留了秘密值。
FROM alpine
ARG key
ARG securekey
RUN echo $key > /tmp/key
RUN echo $securekey > /tmp/securekey && rm /tmp/key
docker build . \
--build-arg key=mykey-isnotsecure \
--build-arg securekey=mykey-issecure -t test
转储图像docker save
:
docker save test | strings | grep -o mykey............
输出:
mykey-isnotsecure
mykey-issecure","
mykey-isnotsecure
mykey-isnotsecure
mykey-issecure","
正如 BMitch 所说:
docker history --no-trunc test
IMAGE CREATED CREATED BY SIZE COMMENT
sha256:e013810c5be50cffa0d9b5e723ec548cdcc686d99efdf792b2bda90baa0795c8 3 hours ago |2 key=mykey-isnotsecure securekey=mykey-issecure /bin/sh -c echo $securekey > /tmp/securekey && rm /tmp/key 15 B
sha256:cabafd664056bc90ea9d71fafcdb65e4abe3d98a66c75066218fcf9a88962ba1 3 hours ago |2 key=mykey-isnotsecure securekey=mykey-issecure /bin/sh -c echo $key > /tmp/key 18 B
sha256:699ff2abecb92b13169a669d99c64fcc19c8d44590778c7b7ee944559208e81a 3 hours ago /bin/sh -c #(nop) ARG securekey 0 B
sha256:26aaa6f92951accc5cb21a13900f9cabee58f65119ffb0eb4b546c3ea19b3ce1 3 hours ago /bin/sh -c #(nop) ARG key 0 B
sha256:a41a7446062d197dd4b21b38122dcc7b2399deb0750c4110925a7dd37c80f118 4 days ago /bin/sh -c #(nop) CMD ["/bin/sh"] 0 B
<missing> 4 days ago /bin/sh -c #(nop) ADD file:ce33aabbc5f370e58ebe911e081ce093e3df18d689c2d5a5d092c77973f62a54 in / 3.97 MB
编辑。关于Time Machine事件的免责声明。
在我的 Mac 上:
▶ date
Tue May 30 16:45:39 ART 2017
我的容器是 3 小时轮班制(ART 与 UTC):
~
▶ docker run ubuntu date
Tue May 30 16:27:29 UTC 2017
艺术 == UTC-3