1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

The option --add-host and --net=host should not be mutually exclusive.

This fix tries to address the issue raised in #21976 and allows
the options of `--add-host` and `--net=host` to work at the same time.

The documentation has been updated and additional tests have been
added to cover this change.

This fix fixes #21976.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2016-05-24 18:49:11 -07:00
parent 23821fe586
commit 90bd41a74d
5 changed files with 19 additions and 11 deletions

View file

@ -67,10 +67,7 @@ func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *check.C) {
func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *check.C) {
testRequires(c, DaemonIsLinux, NotUserNamespace)
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--add-host=name:8.8.8.8", "busybox", "ps")
c.Assert(out, checker.Contains, runconfig.ErrConflictNetworkHosts.Error())
out, _ = dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
c.Assert(out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error())
}