Docker Stack with remote URL

I am using Docker Stack to deploy a suite of images to AWS. I have previously been deploying and testing using docker-compose. The compose file provides a Postgres connection string for an RDS instance. Everything is great with Compose.

Now, I’ve modified the compose file to version 3 and added deploy tags. Then, I push the containers to multiple EC2 instances using docker stack deploy. However, having done this, the app within the container can’t see the RDS instance. It’s fine with compose, just not with stack. Should I be doing something else to enable containers to see remote URLs?

My app is logging

[error] Postgrex.Protocol (#PID<0.299.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (*******.******* non-existing domain - :nxdomain