我有一个 CI Runner,可以自动从 Dockerfile 构建 docker 镜像。我的 docker 镜像基于另一个 docker 镜像。所以我的 Dockerfile 的开头如下所示:
FROM linktoimage/imagename:latest
docker 在构建过程中是否检查我的本地版本的 imagename
是否仍然是最新的(类似于 docker pull?因为我注意到我的 ci 运行程序显示了旧版本的 imagename
如果我在上面运行docker images
最佳答案
Does docker check during the build process if my local version of imagename is still the latest (similar to docker pull)?
不,由于构建缓存,docker 默认情况下不会执行此操作。它将使用本地缓存中的任何现有图像[ 1 ].
但是,您可以使用 --no-cache
选项启用您想要的行为:
$ docker build . --no-cache=true
关于docker - Dockerfile 中的 Docker FROM 关键字是否会查找最新的镜像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74141587/