mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #10689 from duglin/ScratchImage
Show err msg on empty 'scratch' Dockerfile
This commit is contained in:
commit
84fc81e353
2 changed files with 13 additions and 1 deletions
|
@ -163,7 +163,7 @@ func (b *Builder) Run(context io.Reader) (string, error) {
|
|||
}
|
||||
|
||||
if b.image == "" {
|
||||
return "", fmt.Errorf("No image was generated. Is your Dockerfile empty?\n")
|
||||
return "", fmt.Errorf("No image was generated. Is your Dockerfile empty?")
|
||||
}
|
||||
|
||||
fmt.Fprintf(b.OutStream, "Successfully built %s\n", utils.TruncateID(b.image))
|
||||
|
|
|
@ -4870,3 +4870,15 @@ func TestBuildMissingArgs(t *testing.T) {
|
|||
|
||||
logDone("build - verify missing args")
|
||||
}
|
||||
|
||||
func TestBuildEmptyScratch(t *testing.T) {
|
||||
defer deleteImages("sc")
|
||||
_, out, err := buildImageWithOut("sc", "FROM scratch", true)
|
||||
if err == nil {
|
||||
t.Fatalf("Build was supposed to fail")
|
||||
}
|
||||
if !strings.Contains(out, "No image was generated") {
|
||||
t.Fatalf("Wrong error message: %v", out)
|
||||
}
|
||||
logDone("build - empty scratch Dockerfile")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue