Docker Community Forums

Share and learn in the Docker community.

Unable to connect to database running on AWS-RDS


(Tikiwade) #1

I’m a newb.

I have Docker toolbox installed on Windows 7

$ docker --version
Docker version 1.12.2, build bb80604

I am developing a web application that uses mysql running on AWS. When I run the web application locally, it connects to the database and works fine. When I run it in a docker container it fails to connect to the database with the message “Error opening conn - Communications link failure”.

While troubleshooting I discovered that the vpc that the database is in uses the same subnet as the default bridge 172.17.0.0/16. I created my own bridge

$ docker network create --driver=bridge --subnet=152.15.0.0/16 mybridge

And ran the container using that, but that still fails to connect with the same message. It seems to take a little longer to fail using mybridge than it does using the default bridge.


(Tikiwade) #2

Any help would be appreciated


(Tikiwade) #3

I fixed this by specifying the bip when creating the machine.


(Gmanweb) #4

Can you explain more on how you fixed this, similar problem.


(Markitus83) #5

Hi! I have the same problem, I can access to AWS RDS from my localhost but when I run my docker-compose and try to connect to AWS RDS the next message is showed:

Warning: mysqli::__construct(): (HY000/1045): Access denied for user ‘xxxx’@‘XX.XX.XX.XX’

I’ve tried to modify the AWS configuration and docker-compose too but still fails.


(Tikiwade) #6

I never did, I gave up. I now use cloud formation to build my server instances.