Connecting to RDS Mysql from docker container with WordPress

Using docker-compose to spin up a wordpress container but within that container I want to connect to a RDS mysql instance on AWS. I am able to setup the wordpress but can’t connect to the db. I’ve tried changing the DB_NAME variable to _DATABASE. I also am able to use the mysql command line from my mac to make the connection which works

version: '2'

services:
   wordpress:
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       MYSQL_HOST: "endpoint"
       MYSQL_USER: "user"
       MYSQL_PASSWORD: "pass"
       MYSQL_DB_NAME: "wordpress_docker"
       MYSQL_PORT: 3306
     volumes:
       - ${HOME}:/var/lib/mysql

Read more here: Connecting to RDS Mysql from docker container with WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *