build: fix panic when exporting to tar

Fixes a panic on `docker build -t foo -o - . >/dev/null`

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2019-06-03 22:34:13 +00:00
parent 3d21b86e0a
commit 6104eb1ae2

View file

@ -91,7 +91,9 @@ func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string
stdout := config.ProgressWriter.StdoutFormatter
fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
}
err = tagger.TagImages(image.ID(imageID))
if imageID != "" {
err = tagger.TagImages(image.ID(imageID))
}
return imageID, err
}