Fixes #8796
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| ... | ... |
@@ -987,7 +987,7 @@ func (container *Container) updateParentsHosts() error {
|
| 987 | 987 |
c := container.daemon.Get(cid) |
| 988 | 988 |
if c != nil && !container.daemon.config.DisableNetwork && container.hostConfig.NetworkMode.IsPrivate() {
|
| 989 | 989 |
if err := etchosts.Update(c.HostsPath, container.NetworkSettings.IPAddress, container.Name[1:]); err != nil {
|
| 990 |
- return fmt.Errorf("Failed to update /etc/hosts in parent container: %v", err)
|
|
| 990 |
+ log.Errorf("Failed to update /etc/hosts in parent container: %v", err)
|
|
| 991 | 991 |
} |
| 992 | 992 |
} |
| 993 | 993 |
} |
| ... | ... |
@@ -157,3 +157,23 @@ func TestLinksInspectLinksStopped(t *testing.T) {
|
| 157 | 157 |
|
| 158 | 158 |
logDone("link - links in stopped container inspect")
|
| 159 | 159 |
} |
| 160 |
+ |
|
| 161 |
+func TestLinksNotStartedParentNotFail(t *testing.T) {
|
|
| 162 |
+ defer deleteAllContainers() |
|
| 163 |
+ runCmd := exec.Command(dockerBinary, "create", "--name=first", "busybox", "top") |
|
| 164 |
+ out, _, _, err := runCommandWithStdoutStderr(runCmd) |
|
| 165 |
+ if err != nil {
|
|
| 166 |
+ t.Fatal(out, err) |
|
| 167 |
+ } |
|
| 168 |
+ runCmd = exec.Command(dockerBinary, "create", "--name=second", "--link=first:first", "busybox", "top") |
|
| 169 |
+ out, _, _, err = runCommandWithStdoutStderr(runCmd) |
|
| 170 |
+ if err != nil {
|
|
| 171 |
+ t.Fatal(out, err) |
|
| 172 |
+ } |
|
| 173 |
+ runCmd = exec.Command(dockerBinary, "start", "first") |
|
| 174 |
+ out, _, _, err = runCommandWithStdoutStderr(runCmd) |
|
| 175 |
+ if err != nil {
|
|
| 176 |
+ t.Fatal(out, err) |
|
| 177 |
+ } |
|
| 178 |
+ logDone("link - container start not failing on updating stopped parent links")
|
|
| 179 |
+} |