disallow / as source for bind mount in the cli
This makes the docker cli reject docker run commands which include bind mounts like "/:/some/path/in/the/container". Bind mounting the root directory is a bad idea and the cli should throw an error right away. The same check will also be made by the remote API via another commit.
This commit is contained in:
parent
114e01cdc1
commit
4b8c41c4a2
1 changed files with 3 additions and 0 deletions
|
@ -251,6 +251,9 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
|
|||
for bind := range flVolumes {
|
||||
arr := strings.Split(bind, ":")
|
||||
if len(arr) > 1 {
|
||||
if arr[0] == "/" {
|
||||
return nil, nil, cmd, fmt.Errorf("Invalid bind mount: source can't be '/'")
|
||||
}
|
||||
dstDir := arr[1]
|
||||
flVolumes[dstDir] = struct{}{}
|
||||
binds = append(binds, bind)
|
||||
|
|
Loading…
Reference in a new issue