WORKDIR set cmd

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-11-28 15:44:10 -08:00
parent 8c2e674551
commit 1b97bb416b

View file

@ -290,6 +290,17 @@ func workdir(b *Builder, args []string, attributes map[string]bool, original str
return nil return nil
} }
b.runConfig.Image = b.image b.runConfig.Image = b.image
cmd := b.runConfig.Cmd
b.runConfig.Cmd = strslice.StrSlice(append(getShell(b.runConfig), fmt.Sprintf("#(nop) WORKDIR %s", b.runConfig.WorkingDir)))
defer func(cmd strslice.StrSlice) { b.runConfig.Cmd = cmd }(cmd)
if hit, err := b.probeCache(); err != nil {
return err
} else if hit {
return nil
}
container, err := b.docker.ContainerCreate(types.ContainerCreateConfig{Config: b.runConfig}, true) container, err := b.docker.ContainerCreate(types.ContainerCreateConfig{Config: b.runConfig}, true)
if err != nil { if err != nil {
return err return err