mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Make the FROM instruction pull the image if not existing
This commit is contained in:
parent
4ebec08add
commit
924b61328c
1 changed files with 20 additions and 1 deletions
19
builder.go
19
builder.go
|
@ -198,8 +198,27 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
|
||||||
fmt.Fprintf(stdout, "FROM %s\n", arguments)
|
fmt.Fprintf(stdout, "FROM %s\n", arguments)
|
||||||
image, err = builder.runtime.repositories.LookupImage(arguments)
|
image, err = builder.runtime.repositories.LookupImage(arguments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if builder.runtime.graph.IsNotExist(err) {
|
||||||
|
if builder.runtime.graph.LookupRemoteImage(arguments, builder.runtime.authConfig) {
|
||||||
|
if err := builder.runtime.graph.PullImage(stdout, arguments, builder.runtime.authConfig); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// FIXME: Allow pull repo:tag
|
||||||
|
if err := builder.runtime.graph.PullRepository(stdout, arguments, "", builder.runtime.repositories, builder.runtime.authConfig); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
image, err = builder.runtime.repositories.LookupImage(arguments)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case "run":
|
case "run":
|
||||||
fmt.Fprintf(stdout, "RUN %s\n", arguments)
|
fmt.Fprintf(stdout, "RUN %s\n", arguments)
|
||||||
|
|
Loading…
Reference in a new issue