mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-27 16:40:41 +00:00
bump remote api to 1.12 & add --force-rm to build
This adds a `--force-rm` flag to docker build which makes the Docker daemon clean up all containers, even when the build has failed. This new flag requires that we bump the remote API, so we also bump the remote API version. Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
+6
-1
@@ -50,6 +50,7 @@ type buildFile struct {
|
||||
verbose bool
|
||||
utilizeCache bool
|
||||
rm bool
|
||||
forceRm bool
|
||||
|
||||
authConfig *registry.AuthConfig
|
||||
configFile *registry.ConfigFile
|
||||
@@ -807,6 +808,9 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
||||
continue
|
||||
}
|
||||
if err := b.BuildStep(fmt.Sprintf("%d", stepN), line); err != nil {
|
||||
if b.forceRm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
}
|
||||
return "", err
|
||||
} else if b.rm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
@@ -859,7 +863,7 @@ func stripComments(raw []byte) string {
|
||||
return strings.Join(out, "\n")
|
||||
}
|
||||
|
||||
func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *registry.AuthConfig, authConfigFile *registry.ConfigFile) BuildFile {
|
||||
func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeCache, rm bool, forceRm bool, outOld io.Writer, sf *utils.StreamFormatter, auth *registry.AuthConfig, authConfigFile *registry.ConfigFile) BuildFile {
|
||||
return &buildFile{
|
||||
daemon: srv.daemon,
|
||||
srv: srv,
|
||||
@@ -871,6 +875,7 @@ func NewBuildFile(srv *Server, outStream, errStream io.Writer, verbose, utilizeC
|
||||
verbose: verbose,
|
||||
utilizeCache: utilizeCache,
|
||||
rm: rm,
|
||||
forceRm: forceRm,
|
||||
sf: sf,
|
||||
authConfig: auth,
|
||||
configFile: authConfigFile,
|
||||
|
||||
+2
-1
@@ -438,6 +438,7 @@ func (srv *Server) Build(job *engine.Job) engine.Status {
|
||||
suppressOutput = job.GetenvBool("q")
|
||||
noCache = job.GetenvBool("nocache")
|
||||
rm = job.GetenvBool("rm")
|
||||
forceRm = job.GetenvBool("forcerm")
|
||||
authConfig = ®istry.AuthConfig{}
|
||||
configFile = ®istry.ConfigFile{}
|
||||
tag string
|
||||
@@ -496,7 +497,7 @@ func (srv *Server) Build(job *engine.Job) engine.Status {
|
||||
Writer: job.Stdout,
|
||||
StreamFormatter: sf,
|
||||
},
|
||||
!suppressOutput, !noCache, rm, job.Stdout, sf, authConfig, configFile)
|
||||
!suppressOutput, !noCache, rm, forceRm, job.Stdout, sf, authConfig, configFile)
|
||||
id, err := b.Build(context)
|
||||
if err != nil {
|
||||
return job.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user