You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$> docker -v
Docker version 17.06.0-ce, build 02c1d87
$> docker-compose -v
docker-compose version 1.16.1, build 6d1ac219
The --add-host option works correctly with docker build but the extra_hosts of docker-compose doesn't.
I'm using a 3.3 version ok Compose file, here is a sample
I spent two hours this afternoon trying to get that to work, while sorting out that it was not my usage nor my installation (which I just updated to Ubuntu 17.10 with several old versions of docker-compose) that was the problem. The actual thing I want to solve is to facilitate Maven (we do Java) to access a caching proxy running on the host to avoid downloading half the internet every time an image needs to be rebuild. I need a reliable mechanism to refer to the host and thought this might work. I am relatively new to Docker so there might be a trick I have overlooked? I need this to work on Mac and Linux for now, and Windows in the long run.
Activity
shin- commentedon Oct 18, 2017
This is working as intended – the
extra_hostsfield is runtime configuration for your service, it doesn't affect builds.clery commentedon Oct 18, 2017
I see, my bad then. Can you tell me how I am supposed to reproduce the behaviour of
docker build --add-hostwith docker compose then ?shin- commentedon Oct 18, 2017
Unfortunately, that feature hasn't yet been implemented in Compose.
clery commentedon Oct 19, 2017
Well, that's inconvenient !
Thanks for your time anyway :)
ravn commentedon Oct 25, 2017
@shin- is there an open issue for implementing extra_hosts at build time?
shin- commentedon Oct 25, 2017
Well there's this one :)
ravn commentedon Oct 25, 2017
I spent two hours this afternoon trying to get that to work, while sorting out that it was not my usage nor my installation (which I just updated to Ubuntu 17.10 with several old versions of docker-compose) that was the problem. The actual thing I want to solve is to facilitate Maven (we do Java) to access a caching proxy running on the host to avoid downloading half the internet every time an image needs to be rebuild. I need a reliable mechanism to refer to the host and thought this might work. I am relatively new to Docker so there might be a trick I have overlooked? I need this to work on Mac and Linux for now, and Windows in the long run.
[-]Extra_hosts not working[/-][+]Add support for build-time extra_hosts[/+]kinnalru commentedon Apr 19, 2018
@shin- there is no such option in version 3 config file. Why?
greyblake commentedon Jul 16, 2018
Does someone know some work arounds for this?
momovuk commentedon Jul 27, 2018
Is there any news in this regards? When the extra_hosts will finally add the values to /etc/hosts, it would be highly appreciated!
kinnalru commentedon Aug 15, 2018
I open new issue #6138
kinnalru commentedon Aug 16, 2018
Issue moved to https://github.com/docker/cli repo
Compose > Compose-file > 'extra_hosts' > buildtime/runtime documentation