Make init accept a list of images not just a single one.

fix #1527

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-04-07 14:25:28 +01:00
parent be9ee95c4c
commit 7e1f2088d3
2 changed files with 18 additions and 15 deletions

View File

@ -97,21 +97,24 @@ func buildInternal(name string, pull bool, conf string) {
}
initrdAppend(iw, ktar)
// convert init image to tarball
// convert init images to tarballs
log.Infof("Add init containers:")
for _, ii := range m.Init {
if pull {
log.Infof("Pull init: %s", m.Init)
err := dockerPull(m.Init)
log.Infof("Pull init image: %s", ii)
err := dockerPull(ii)
if err != nil {
log.Fatalf("Could not pull image %s: %v", m.Init, err)
log.Fatalf("Could not pull image %s: %v", ii, err)
}
}
log.Infof("Process init: %s", m.Init)
init, err := ImageExtract(m.Init, "")
log.Infof("Process init image: %s", ii)
init, err := ImageExtract(ii, "")
if err != nil {
log.Fatalf("Failed to build init tarball: %v", err)
log.Fatalf("Failed to build init tarball from %s: %v", ii, err)
}
buffer := bytes.NewBuffer(init)
initrdAppend(iw, buffer)
}
log.Infof("Add system containers:")
for i, image := range m.System {
@ -161,7 +164,7 @@ func buildInternal(name string, pull bool, conf string) {
}
// add files
buffer, err = filesystem(m)
buffer, err := filesystem(m)
if err != nil {
log.Fatalf("failed to add filesystem parts: %v", err)
}

View File

@ -24,7 +24,7 @@ type Moby struct {
Image string
Cmdline string
}
Init string
Init []string
System []MobyImage
Daemon []MobyImage
Files []struct {