--add-host doesn't work
Closed this issue · 6 comments
--add-host
is supported according to https://apidocs.joyent.com/docker/commands/run
I ran this with DOCKER_HOST=tcp://eu-ams-1.docker.joyent.com:2376
$ docker run --rm -it --add-host "foo:111.111.111.111" redis:latest bash
root@ed8ffdbcd7a1:/data# cat /etc/hosts
192.168.129.186 ed8ffdbcd7a1
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I would expect to see a line containing 111.111.111.111 foo
in the hosts file.
Actually in the Divergence section it says: "--add-host (host-to-IP mapping) is ignored. See networking."
However, (a) that isn't helpful, because the linked-to networking page doesn't have any searchable content related to "host" or "add-host"; and (b) it is easy to assume from the other hits for "add-host" in https://github.com/joyent/sdc-docker/blob/master/docs/api/commands/run.md that --add-host
is supported.
@askfongjojo @misterbisson Thoughts? Some notes:
- Remove this section https://github.com/joyent/sdc-docker/blob/master/docs/api/commands/run.md#adding-entries-to-a-container-hosts-file or replace its content with details that
--add-host
is not support. - Add "see Divergence section" notes to all the options in the https://github.com/joyent/sdc-docker/blob/master/docs/api/commands/run.md#run section for which there is a divergence.
- Perhaps we could support
--add-host
?
This is one of the most useful flags docker has, why isn't this supported?
https://github.com/joyent/sdc-docker/blob/master/docs/api/commands/run.md#adding-entries-to-a-container-hosts-file gives a detailed example with host to ip mapping, reading that it's reasonable to think that it is supported.
@j0hnsmith yup, agree. Looking into adding it.
internal ticket we'd had for this: https://smartos.org/bugview/DOCKER-694
DOCKER-694 is fixed in #master. However, note https://smartos.org/bugview/DOCKER-775
Until that is implemented --add-hosts will not reliably work unless the DC in question has updated all compute nodes (servers) to a recent platform build. Also, it may be a while until this is deployed to ams1 where you were testing. This should be in our beta/test "us-east-3b" datacenter today.
Cool, thanks.