4

I am trying to run my docker development setup and I can't access host from

docker build --add-host mymachinelocalip:ss-local

in my production ubuntu envrionment, by caling in Dockerfile:

RUN curl -f http://ss-local:8181

my /etc/hosts :

::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.1  ss-local
172.17.0.5  e1ede117fb1e

On my local computer (MacOSX El Capitan and Windows10) everything works perfect.. But on digitalocean droplet with Ubuntu curl command fail.

I am beginer with docker.. and I am wondering maybe there is some kind of firewall on linux that prevent connections to host...

Ubuntu 16.04.2 LTS with Docker version 17.06.0-ce, build 02c1d87.

3
  • Do you get the same issue if the --add-host mapping is done at run time and using an IP address different then the docker0 interface. i(ie: docker run -ti --add-host "ss-local:192.168.120.154" ubuntu bash) Commented Jul 11, 2017 at 20:23
  • it is not working also at runtime... Commented Jul 11, 2017 at 23:02
  • Temporary solution: downgrade to Ubuntu 14.04.5 LTS.... Commented Jul 13, 2017 at 14:27

1 Answer 1

4

When you pass --add-host to docker build, the host is only added during the build. If you pass --add-host to docker run, the host will be present at runtime.

Reference: https://github.com/moby/moby/pull/30383#issuecomment-314797629

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.