mirror of
https://github.com/docker/cli.git
synced 2026-09-25 17:02:07 -04:00
Merge pull request #9281 from unclejack/build_pull_flag
build: add pull flag to force image pulling Upstream-commit: 5e19ecf25c942ae809ad5b5cf0bb010845395e58 Component: engine
This commit is contained in:
@@ -81,6 +81,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
||||
noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
|
||||
rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
|
||||
forceRm := cmd.Bool([]string{"-force-rm"}, false, "Always remove intermediate containers, even after unsuccessful builds")
|
||||
pull := cmd.Bool([]string{"-pull"}, false, "Always attempt to pull a newer version of the image")
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
@@ -217,6 +218,9 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
||||
v.Set("forcerm", "1")
|
||||
}
|
||||
|
||||
if *pull {
|
||||
v.Set("pull", "1")
|
||||
}
|
||||
cli.LoadConfigFile()
|
||||
|
||||
headers := http.Header(make(map[string][]string))
|
||||
|
||||
@@ -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") {
|
||||
job.Setenv("pull", "1")
|
||||
}
|
||||
job.Stdin.Add(r.Body)
|
||||
job.Setenv("remote", r.FormValue("remote"))
|
||||
job.Setenv("t", r.FormValue("t"))
|
||||
|
||||
Reference in New Issue
Block a user