I have a DockerFile, for example, that contains the following line to pull the base image:
FROM myHub.com/base-image
I'm not specifying which tag to use. Now, let's say a newer image of base-image
is pushed into the hub (version 2). If I run docker build
again, docker figures out that my local system already has the base image pulled, so it uses the cache and keeps (version 1).
A quick fix is for me to specify the tag:
FROM myHub.com/base-image:2.0
But that doesn't seem very efficient. Because when a newer version is pushed again, I will have to manually change the tag in my dockerfile. Is there a better way to handle this? I'm new to Docker so there is quite a bit I'm unfamiliar with. Thanks
solution:
docker build --pull
explanation:
--pull
Always attempt to pull a newer version of the image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.