Devs.tw 是讓工程師寫筆記、網誌的平台。歡迎您隨手紀錄、寫作,方便日後搜尋!
FROM nginx:latest
COPY index.html /usr/share/nginx/html
COPY linux.png /usr/share/nginx/html
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
連 FROM 都沒有,想看 base image 都沒辦法欸
As far as I know, no, you can't. Because a Dockerfile is used for building the image, it is not packed with the image itself.
That Docker Hub history view doesn't show the actual Dockerfile; instead, it shows content essentially extracted from the docker history of the image. That doesn't preserve the specific details you're looking for: it doesn't remember the names of base images, or the build-context file names of things that get ADDed or COPYed in.
而且 base image 的 docker image 還很常會有自己的指令
像 php-8.0:fpm 其實就事先裝了一些系統級套件跟幫忙設定基本的 php 生態系
保險起見稍微瞄一下 base image 的 git repository 會比較知道它到底做了哪些事