Connecting to host TCP/IP server from inside docker container

Hi

I'm trying to connect to an TCP/IP server that I'm running on my host computer, I'm using the TCP Driver but the connection is refused.

docker run -d -p 9088:8088 -p 9001:9001 -p 9002:9002 --name ignition-edge -v igw-data:/usr/local/bin/ignition/data --pull always inductiveautomation/ignition:latest -n docker-test -a localhost -h 9088 -s 9043

The server is listening on 127.0.0.1 and port 9001.

Is there any configuration that I need to do when running it in a docker container that I'm missing?

Don't put any mention of port 9001 in your docker command. That is for port mappings from host to container, and will interfere with traffic from container to host.

Then, use your host's name instead of localhost from inside the container.

Here are a couple useful references for you:

1 Like

Thank you, when using host.docker.internal everything worked as expected.

1 Like