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)

Prateek Narendra
  • 1,837
  • 5
  • 38
  • 67
  • 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. – Mihai Apr 10 '19 at 08:16
  • @Mihai how Do i do that? – Prateek Narendra Apr 11 '19 at 05: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= .... Then from inside the host you can run: ping myhost – Mihai Apr 11 '19 at 05:56

0 Answers0