Merge pull request #5140 from unclejack/build_immediate_cleanup
delete containers during build after every step
This commit is contained in:
commit
897bf5439d
1 changed files with 3 additions and 3 deletions
|
@ -69,6 +69,7 @@ func (b *buildFile) clearTmp(containers map[string]struct{}) {
|
|||
if err := b.runtime.Destroy(tmp); err != nil {
|
||||
fmt.Fprintf(b.outStream, "Error removing intermediate container %s: %s\n", utils.TruncateID(c), err.Error())
|
||||
} else {
|
||||
delete(containers, c)
|
||||
fmt.Fprintf(b.outStream, "Removing intermediate container %s\n", utils.TruncateID(c))
|
||||
}
|
||||
}
|
||||
|
@ -780,14 +781,13 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
|||
}
|
||||
if err := b.BuildStep(fmt.Sprintf("%d", stepN), line); err != nil {
|
||||
return "", err
|
||||
} else if b.rm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
}
|
||||
stepN += 1
|
||||
}
|
||||
if b.image != "" {
|
||||
fmt.Fprintf(b.outStream, "Successfully built %s\n", utils.TruncateID(b.image))
|
||||
if b.rm {
|
||||
b.clearTmp(b.tmpContainers)
|
||||
}
|
||||
return b.image, nil
|
||||
}
|
||||
return "", fmt.Errorf("No image was generated. This may be because the Dockerfile does not, like, do anything.\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue