1
0
mirror of https://github.com/moby/moby.git synced 2025-07-29 07:21:35 +03:00

Check for nil before using HostConfig to adjustCpuShares

Fix #14915. Add unit test for #14915.
Thanks @runcom for the test case: when the client calls 1.18 api
version w/o hostconfig it results in a nil pointer dereference.

Signed-off-by: Stephen Rust <srust@blockbridge.com>
This commit is contained in:
Stephen Rust
2015-07-25 07:39:13 -04:00
parent c051ed7953
commit c358a4cd35
2 changed files with 11 additions and 1 deletions

View File

@ -1687,3 +1687,13 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *ch
c.Assert(res.StatusCode, check.Equals, http.StatusNoContent)
b.Close()
}
// #14915
func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
config := struct {
Image string
}{"busybox"}
status, _, err := sockRequest("POST", "/v1.18/containers/create", config)
c.Assert(err, check.IsNil)
c.Assert(status, check.Equals, http.StatusCreated)
}