зеркало из https://github.com/microsoft/docker.git
Prevent deadlock on attempt to use own net
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
This commit is contained in:
Родитель
6cba3109c2
Коммит
f30d1c1835
|
@ -1515,6 +1515,9 @@ func (container *Container) getNetworkedContainer() (*Container, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if container == nc {
|
||||
return nil, fmt.Errorf("cannot join own network")
|
||||
}
|
||||
if !nc.IsRunning() {
|
||||
return nil, fmt.Errorf("cannot join network of a non running container: %s", parts[1])
|
||||
}
|
||||
|
|
|
@ -2657,6 +2657,14 @@ func (s *DockerSuite) TestContainerNetworkMode(c *check.C) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerNetworkModeToSelf(c *check.C) {
|
||||
cmd := exec.Command(dockerBinary, "run", "--name=me", "--net=container:me", "busybox", "true")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err == nil || !strings.Contains(out, "cannot join own network") {
|
||||
c.Fatalf("using container net mode to self should result in an error")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunModePidHost(c *check.C) {
|
||||
testRequires(c, NativeExecDriver, SameHostDaemon)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче