1

My host has access to the API but when I enter docker container it doesn't. I've already added DNS to docker daemon

The host I want to access is an external API working on 80 port I want to connect to it via CURL

When I do PING from my host I get responses When I do PING from container I get unknown host

My networking is set to bridge.

I was thinking about setting up the proxy but maybe there's a better way.

Robert
  • 19,800
  • 5
  • 55
  • 85
  • Assuming the API you are trying to reach is external to your HOST or other containers, this link https://stackoverflow.com/questions/20430371/my-docker-container-has-no-internet may be helpful – piy26 Jul 31 '18 at 13:05
  • @piy26 thank you for response, my container has access to the Internet and to nameservers as well which I specified in daemon.json – Robert Jul 31 '18 at 13:26

1 Answers1

0

The easiest way would probably be to use network_mode: host in your docker-compose.yml. This is great as long as you use a singe container, but if you want several to communicate, bridge is better.

See here for more info: https://docs.docker.com/network/#network-drivers

Jacob Sievers
  • 506
  • 4
  • 13