From d1aaf129f22294569031193d694d5350fcd98148 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Tue, 24 May 2016 18:49:11 -0700 Subject: [PATCH] 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 --- docs/reference/run.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference/run.md b/docs/reference/run.md index 9fd6d05f..567d42b2 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -382,14 +382,14 @@ name, they must be linked. With the network set to `host` a container will share the host's network stack and all interfaces from the host will be available to the container. The container's hostname will match the hostname on the host -system. Note that `--add-host` and `--mac-address` are invalid in `host` netmode. Even in `host` +system. Note that `--mac-address` is invalid in `host` netmode. Even in `host` network mode a container has its own UTS namespace by default. As such `--hostname` is allowed in `host` network mode and will only change the hostname inside the container. -Note also that `--dns`, `--dns-search` and `--dns-opt` are -valid in `host` mode and `/etc/resolv.conf` will be updated accordingly. However, the -update in `/etc/resolv.conf` only happens inside the container. No change will be -made for `/etc/resolv.conf` in host. +Similar to `--hostname`, the `--add-host`, `--dns`, `--dns-search`, and +`--dns-opt` options can be used in `host` network mode. These options update +`/etc/hosts` or `/etc/resolv.conf` inside the container. No change are made to +`/etc/hosts` and `/etc/resolv.conf` on the host. Compared to the default `bridge` mode, the `host` mode gives *significantly* better networking performance since it uses the host's native networking stack