0

I have a Web Application running on my host at port 8082 (localhost:8082). I want to access this web application through my docker container.

A quick check by installing wget on my container and running wget localhost:8082 , I got -

Connecting to localhost (localhost)|127.0.0.1|:8082... failed: Connection refused.
Connecting to localhost (localhost)|::1|:8082... failed: Network is unreachable.

Is there some configuration I need to do so that my container can access the app running on my host?

PS - Localhost is Linux (CentOS)

3
  • you have to add the IP of your host as an extra host to the container (mapped to a name). Then from inside the container you can ping the host using the name you provided in the mapping. Commented Apr 10, 2019 at 8:16
  • @Mihai how Do i do that? Commented Apr 11, 2019 at 5:50
  • First find out the IP of your host (ip addr show OR ifconfig) and then change your docker command: docker run --add-host myhost=<ip from before> .... Then from inside the host you can run: ping myhost Commented Apr 11, 2019 at 5:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.