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 I created my own bridge

$ docker network create --driver=bridge --subnet= 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.

(Utkarsh Sinha) #7

I was running a docker container locally on OSX. I was trying to connect to an AWS RDS instance from inside my container, using the following command:

mysql -h aws-rds-endpoint -P 3306 -u master-username -p

this was failing resulting in the following error:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘’ (111)

I found out that ‘Public Accessibility’ under ‘Connectivity’ for my RDS was set to ‘No’. I modified the setting to ‘Yes’, and it started working.