Search code examples
pythondockerpymysql

Connect the docker container to an RDS db


I have a docker container on a EC2 if i run the code directly in EC2 everything is fine, but when the docker is running it throws the next error

(1045, "Access denied for user 'xxxxx'@'xxxx' (using password: YES)")

I know that's an error in the connection, but is the same user, password and ip of the EC2.

I execute the docker image with network in host mode and the problem persist

I'm using a python image and pymysql to conect to my db

This is exactly my problem Accessing RDS from within a Docker container not getting through security group?


Solution

  • My solution was to use ECS and avoid ec2 to run the docker image