Docker Community Forums

Share and learn in the Docker community.

Why can't my container connect to a swarm service


(Rossdargan) #1

TLDR: I have a container running using docker swarm and a container on the same node can’t connect to it by it’s ip.

I have a swarm service running on an ubuntu machine that hosts a telnet service. I currently only have two nodes, but everything is running on the dar-docker-03 node.

ID                           HOSTNAME       STATUS  AVAILABILITY  MANAGER STATUS
3frjwk3h4s8d9z7gtdqfomx18 *  dar-docker-03  Ready   Active        Leader
72zgcjxubn9b0o5k61k17erhx    dar-docker-02  Ready   Active

Iit’s running one swarm service (basically a telnet service)

ross@dar-docker-03:~$ docker service ls
ID            NAME          REPLICAS  IMAGE                  COMMAND
ad1kwgqxznmi  alarm-daemon  1/1       rossdargan/ls30daemon

The service is running on the leader node:

a81856e8c753 rossdargan/ls30daemon:latest "bin/alarm-daemon.pl " 15 hours ago Up 15 hours (healthy) 1681/tcp alarm-daemon.1.5v2gm85zjf9n57su2tjfnhxg0

The service is using the ingress network, which is configured as an overlay network.

I can telnet to it just fine to the service if I use dar-docker-03’s ip (the node it is running on), but can’t via dar-docker-02 ip which is odd as I’m sure I should be able to do that, but I’m not sure it is related.

Anyway, the issue is I have a container that can’t connect to the telnet service. It worked fine when both of the containers were running using docker-compose, but since I’ve moved this one to run as a docker swarm service I can’t get them to talk to each other.