TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
183 stars 49 forks source link

--add-host doesn't work #72

Closed j0hnsmith closed 8 years ago

j0hnsmith commented 8 years ago

--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.

trentm commented 8 years ago

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:

j0hnsmith commented 8 years ago

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.

trentm commented 8 years ago

@j0hnsmith yup, agree. Looking into adding it.

trentm commented 8 years ago

internal ticket we'd had for this: https://smartos.org/bugview/DOCKER-694

trentm commented 8 years ago

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.

j0hnsmith commented 8 years ago

Cool, thanks.