-
Notifications
You must be signed in to change notification settings - Fork 18.8k
build: add pull flag to force image pulling #9281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I need to update this to modify the API docs. |
So much cleaner and simpler than |
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
ceea5b0
to
054e57a
Compare
@@ -1016,6 +1016,9 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite | |||
} else { | |||
job.Setenv("rm", r.FormValue("rm")) | |||
} | |||
if r.FormValue("pull") == "1" && version.GreaterThanOrEqualTo("1.16") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? I think we could always set it and we would be ok right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to make sure we don't change older API versions. This is similar to the checks for the --rm
and --force-rm
flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But these old versions don't have this flag right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they don't have it and that's the reason why we're making sure we don't allow it for older versions.
API and doc changes have been made. |
LGTM |
1 similar comment
LGTM |
build: add pull flag to force image pulling
It is important to keep Docker images up-to date, as upstream images could have important security fixes, even using the same tag and version. When building images, it is possible to pass in a `--pull` flag to check if the base image has updates, and rebuild as necessary. This feature is available since 2014, and will still retain the image cache if there are no updates on the base image. [since 2014]: moby/moby#9281
Hello, Is there a way to use this --pull flag via docker-compose? Something like this? |
This PR adds a flag to
docker build
.docker build --pull .
will force the pulling of the image, even if it exists locally.Force pulling the image will update the existing local image if there's one.