Talk to database from swarm

I’m have a swarm with 3 containers and then I created a mysql instance using the docker run command. I can talk to my database from my machine on IP 172.17.0.2 but I cannot talk to the database from inside any of my swarm containers.
I have tried 172.17.0.1,172.17.0.1,127.0.0.1

From inside a swarm container I can ping 172.17.0.1 but I cannot ping 172.17.0.2.

Can anybody please advise?

Hello,

Did you link them?
Inspect the services to see networks information.

Nicolas