Merge pull request #1581 from mhennings/workdirsupport-buildfile
Add workdir support for the Buildfile Upstream-commit: 9c829cb5b4b0a06cb4264f77c0582731594bf1b5 Component: engine
This commit is contained in:
@ -222,6 +222,11 @@ func (b *buildFile) CmdEntrypoint(args string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *buildFile) CmdWorkdir(workdir string) error {
|
||||
b.config.WorkingDir = workdir
|
||||
return b.commit("", b.config.Cmd, fmt.Sprintf("WORKDIR %v", workdir))
|
||||
}
|
||||
|
||||
func (b *buildFile) CmdVolume(args string) error {
|
||||
if args == "" {
|
||||
return fmt.Errorf("Volume cannot be empty")
|
||||
|
||||
@ -205,6 +205,14 @@ to the entrypoint.
|
||||
The ``VOLUME`` instruction will add one or more new volumes to any
|
||||
container created from the image.
|
||||
|
||||
3.10 WORKDIR
|
||||
--------------
|
||||
|
||||
``WORKDIR /path/to/workdir``
|
||||
|
||||
The ``WORKDIR`` instruction sets the working directory in which
|
||||
the command given by ``CMD`` is executed.
|
||||
|
||||
4. Dockerfile Examples
|
||||
======================
|
||||
|
||||
|
||||
@ -132,6 +132,9 @@ func MergeConfig(userConf, imageConf *Config) {
|
||||
if userConf.Entrypoint == nil || len(userConf.Entrypoint) == 0 {
|
||||
userConf.Entrypoint = imageConf.Entrypoint
|
||||
}
|
||||
if userConf.WorkingDir == "" {
|
||||
userConf.WorkingDir = imageConf.WorkingDir
|
||||
}
|
||||
if userConf.VolumesFrom == "" {
|
||||
userConf.VolumesFrom = imageConf.VolumesFrom
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user