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> Upstream-commit: 90bd41a74d57080711678bffa2bc4371020ee3a5 Component: engine
This commit is contained in:
@@ -56,7 +56,7 @@ func ValidateNetMode(c *container.Config, hc *container.HostConfig) error {
|
||||
return ErrConflictNetworkAndDNS
|
||||
}
|
||||
|
||||
if (hc.NetworkMode.IsContainer() || hc.NetworkMode.IsHost()) && len(hc.ExtraHosts) > 0 {
|
||||
if hc.NetworkMode.IsContainer() && len(hc.ExtraHosts) > 0 {
|
||||
return ErrConflictNetworkHosts
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user