Docker Community Forums

Share and learn in the Docker community.

Connection refused between containers on docker swarm that runs on Amazon EC2

Hi all,

I created a docker swarm using 2 nodes on Amazon AWS and deployed two containers on swarm by using labels. The first one(redis) is running on swarm manager and the second (my app) docker is running on worker. However when my app tries to connect to the redis, the connection is refused.
The app tries to connect using the service name of the container. I did a lot of tests. I successfully managed to ping the redis container from “my app” container and vice versa. However when i tried to telnet on the redis port, the connection is refused. I have opened also on the security group the redis port, however the problems exists.

Has anyone managed to run docker swarm on amazon aws?

Os:Ubuntu 20.04.2 LTS
Docker version: 20.10.3