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:
I'll also augment that as of Docker Engine 20.10, you can also use host.docker.internal mapping on Linux (where it was previously only available on Docker Desktop). You do have to add an extra_hosts mapping to your container definition though, such as:
docker run ... --add-host "host.docker.internal:host-gateway" ...
... or in your Compose YAML:
services:
gateway:
...
extra_hosts:
- "host.docker.internal:host-gateway"
....
With this, the hostname host.docker.internal wil…
1 Like
Thank you, when using host.docker.internal everything worked as expected.
1 Like