I build 2 docker container with docker-compose. I use Docker on Mac, no boot2docker.
version: \'2\'
services:
drupal-web:
image: drupal:
Should look a bit more like this:
version: '2'
services:
mysql-server:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
drupal-web:
image: drupal:latest
ports:
- "8080:80"
depends_on:
- mysql-server
links:
- mysql-server:mysql-server
environment:
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
(Im not sure if defining the environment variables on a global level work, maybe someone who knows can correct my answer here and simplify it)
As you can see, you have 2 services, mysql-server and drupal-web. Drupal-web links your database service. Both services have their own environment variables.