Say on the host machine I have a server running on localhost:4000
. How do I connect to that server from inside a Docker container?
This is a security risk in some cases, but in my case, this is running on my personal machine, so I can give the container all the privileges it needs to talk with the host machine.
For example in the Docker container, if I run:
RUN nc localhost 4000 | xargs echo
I don't think that's going to to be able to connect to the server running on the host, unless I take some extra steps.