Merge pull request #9014 from LK4D4/fix_parent_failing
Not fail on updating parent links
This commit is contained in:
commit
84f25414c1
2 changed files with 21 additions and 1 deletions
|
@ -987,7 +987,7 @@ func (container *Container) updateParentsHosts() error {
|
|||
c := container.daemon.Get(cid)
|
||||
if c != nil && !container.daemon.config.DisableNetwork && container.hostConfig.NetworkMode.IsPrivate() {
|
||||
if err := etchosts.Update(c.HostsPath, container.NetworkSettings.IPAddress, container.Name[1:]); err != nil {
|
||||
return fmt.Errorf("Failed to update /etc/hosts in parent container: %v", err)
|
||||
log.Errorf("Failed to update /etc/hosts in parent container: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,3 +157,23 @@ func TestLinksInspectLinksStopped(t *testing.T) {
|
|||
|
||||
logDone("link - links in stopped container inspect")
|
||||
}
|
||||
|
||||
func TestLinksNotStartedParentNotFail(t *testing.T) {
|
||||
defer deleteAllContainers()
|
||||
runCmd := exec.Command(dockerBinary, "create", "--name=first", "busybox", "top")
|
||||
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil {
|
||||
t.Fatal(out, err)
|
||||
}
|
||||
runCmd = exec.Command(dockerBinary, "create", "--name=second", "--link=first:first", "busybox", "top")
|
||||
out, _, _, err = runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil {
|
||||
t.Fatal(out, err)
|
||||
}
|
||||
runCmd = exec.Command(dockerBinary, "start", "first")
|
||||
out, _, _, err = runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil {
|
||||
t.Fatal(out, err)
|
||||
}
|
||||
logDone("link - container start not failing on updating stopped parent links")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue