diff --git a/container.go b/container.go index 108f5df3f1..c08d45624d 100644 --- a/container.go +++ b/container.go @@ -396,6 +396,10 @@ func (c *ContainerRequest) BuildOptions() (types.ImageBuildOptions, error) { buildOptions.Tags = []string{tag} } + if !c.ShouldKeepBuiltImage() { + buildOptions.Labels = core.DefaultLabels(core.SessionID()) + } + return buildOptions, nil } diff --git a/docker_test.go b/docker_test.go index 9d3593d040..5e249d60fa 100644 --- a/docker_test.go +++ b/docker_test.go @@ -823,8 +823,8 @@ func Test_BuildContainerFromDockerfileWithBuildLog(t *testing.T) { os.Stdout = rescueStdout temp := strings.Split(string(out), "\n") - if !regexp.MustCompile(`(?i)^Step\s*1/1\s*:\s*FROM docker.io/alpine$`).MatchString(temp[0]) { - t.Errorf("Expected stdout firstline to be %s. Got '%s'.", "Step 1/1 : FROM docker.io/alpine", temp[0]) + if !regexp.MustCompile(`^Step\s*1/\d+\s*:\s*FROM docker.io/alpine$`).MatchString(temp[0]) { + t.Errorf("Expected stdout firstline to be %s. Got '%s'.", "Step 1/* : FROM docker.io/alpine", temp[0]) } }