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. Upstream-commit: 4b8c41c4a2591797f97ad079e4314b21498ba732 Component: engine
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user