1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #28909 from Microsoft/jjh/moreworkdir2

WORKDIR set cmd
This commit is contained in:
Doug Davis 2016-11-28 20:35:21 -05:00 committed by GitHub
commit 1ef10c83c7

View file

@ -290,6 +290,17 @@ func workdir(b *Builder, args []string, attributes map[string]bool, original str
return nil
}
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)
if err != nil {
return err