0

I'm trying to generate a multi-container Docker WordPress deployment on Beanstalk by running a Dockerrun.aws.json file from the EB CLI. Here's my Dockerrun:

{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
    {
        "name": "mariadb",
        "image": "mariadb:latest",
        "essential": true,
        "memory": 128,
        "portMappings": [
            {
                "hostPort": 3306,
                "containerPort": 3306
            }
        ],
        "environment": [
            {
                "name": "MYSQL_USERNAME",
                "value": "root"
            },
            {
                "name": "MYSQL_PASSWORD",
                "value": "password"
            },
            {
                "name": "MYSQL_DB_NAME",
                "value": "wordpress"
            }
        ]
    },
    {
        "name": "wordpress",
        "image": "wordpress",
        "essential": true,
        "memory": 128,
        "portMappings": [
            {
                "hostPort": 80,
                "containerPort": 80
            }
        ],
        "links": [
            "mariadb"
        ],
        "environment": [
            {
                "name": "MYSQL_ROOT_PASSWORD",
                "value": "password"
            }
        ]
     }
  ]
}

The Beanstalk environment launches properly and I can browse to the endpoint and begin the WordPress configuration, but it never connects to the MariaDB. When I SSH into the host instance, I can see that both the WordPress and MariaDB containers are launching over and over again - and failing. There are multiple mariadb-* log files in /var/log/containers/ on the host, all with this text:

error: database is uninitialized and password option is not specified 
You need to specify one of MYSQL_ROOT_PASSWORD, 
MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD

My guess is that the password isn't making it through. Any ideas why not? Thanks

  • I should note that I added an IAM policy opening up resources for EC2...which hasn't helped. – dlanced Mar 20 '17 at 13:16
0

The solution was simple. The syntax I was using was wrong. I originally used:

"name": "MYSQL_DB_NAME"

But it should have been:

"name": "MYSQL_DATABASE"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.