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>
(cherry picked from commit 6104eb1ae2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Tibor Vass 2019-06-03 22:34:13 +00:00 committed by Sebastiaan van Stijn
parent a62d9b9c21
commit b915ec1e7b
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

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
}