Merge pull request #18318 from calavera/fix_dns_setting_on_hostconfig_start
Make sure container start doesn't make the DNS fields nil. Upstream-commit: c247b3d104ad7e768e2540fccb3861c36eb2e60f Component: engine
This commit is contained in:
@ -1371,3 +1371,20 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *check.C)
|
||||
expected = "Invalid value 42-3,1-- for cpuset mems.\n"
|
||||
c.Assert(string(body), checker.Equals, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
config := `{"HostConfig": {"Dns": null}}`
|
||||
|
||||
res, b, err := sockRequestRaw("POST", "/containers/"+containerID+"/start", strings.NewReader(config), "application/json")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
|
||||
b.Close()
|
||||
|
||||
dns, err := inspectFieldJSON(containerID, "HostConfig.Dns")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(dns, checker.Equals, "[]")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user