Add flag `--host` to `service create` and `--host-add/--host-rm` to `service update`

This fix tries to address 27902 by adding a flag `--host`
to `docker service create` and `--host-add/--host-rm` to
`docker service update`, so that it is possible to
specify extra `host:ip` settings in `/etc/hosts`.

This fix adds `Hosts` in swarmkit's `ContainerSpec` so that it
is possible to specify extra hosts during service creation.

Related docs has been updated.

An integration test has been added.

This fix fixes 27902.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2016-11-03 08:05:00 -07:00 committed by Tibor Vass
parent 2d85970a8c
commit 9cda7c331e
2 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Options:
--health-retries int Consecutive failures needed to report unhealthy
--health-timeout duration Maximum time to allow one check to run (default none)
--help Print usage
--host list Set one or more custom host-to-IP mappings (host:ip) (default [])
--hostname string Container hostname
-l, --label list Service labels (default [])
--limit-cpu decimal Limit CPUs (default 0.000)

View File

@ -43,6 +43,8 @@ Options:
--health-retries int Consecutive failures needed to report unhealthy
--health-timeout duration Maximum time to allow one check to run (default none)
--help Print usage
--host-add list Add or update a custom host-to-IP mapping (host:ip) (default [])
--host-rm list Remove a custom host-to-IP mapping (host:ip) (default [])
--image string Service image tag
--label-add list Add or update a service label (default [])
--label-rm list Remove a label by its key (default [])