【发布时间】:2020-04-16 22:21:34
【问题描述】:
我有一个多级 Dockerfile,如下所示。当 Dockerfile 中引用的映像之一更新时,如何确保在基于此 Dockerfile 构建映像时再次拉取最新版本/始终拉取最新版本。使用 --no-cache 运行 docker build 命令仍然引用旧版本的映像,但实际上并没有从 docker 注册表中提取最新版本。
docker build --no-cache -t test_deploy -f Dockerfile
FROM myreg.abc.com/testing_node:latest AS INITIMG
....
....
RUN npm install
RUN npm run build
FROM myreg.abc.com/testing_nginx:latest
COPY --from=INITIMG /sourcecode/build/ /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
【问题讨论】:
标签: docker dockerfile docker-registry docker-multi-stage-build