Allow my docker container to make network requests

时间:2019-01-09 22:02:26

标签: docker

I have my application running locally in a Docker container, I have published the port which I want to use to invoke its API. However, my Docker container application also needs to make other network requests to externally hosted APIs. Currently I am getting network errors when it tries to make these requests. How do I give my Docker container access to the same network that my local machine is on? Is there a Docker config I need to pass to my docker -it -p 8080:8080 command?

1 个答案:

答案 0 :(得分:0)

You need to add these options to your docker run command:

--network host

It will bind container networking directly to the Docker host’s network.

Documentation: https://docs.docker.com/network/host/