I'm trying to use docker-compose to create a LAMP environment along with phpunit to run TDD php and what I want to do is this:
-
run a mysql image 5;
-
run an image phpunit 5;
-
run a php 5.6 image so that it communicates with the other images;
My docker-compose looks like this:
version: '2'
services:
mysql:
image: mysql:5
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: 12345
MYSQL_DATABASE: lamp-teste
php-unit:
image: phpunit/phpunit:5.7.12
php-5.6:
image: php:5.6
ports:
- 8080:80
volumes:
- ./log/apache2/error.log:/var/log/apache2/error.log
- ./log/apache2/access.log:/var/log/apache2/access.log
- ./html:/var/www/html
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: root
depends_on:
- mysql
- php-unit
After running the file with the docker-compose up -d command this appears:
Recreating dockerlampteste_mysql_1 ...
Recreating dockerlampteste_php-unit_1 ...
Recreating dockerlampteste_php-unit_1
Recreating dockerlampteste_mysql_1 ... done
Recreating dockerlampteste_php-5.6_1 ...
Recreating dockerlampteste_php-5.6_1 ... done
And when you run the "docker-compose ps" command this appears:
Name Command State Ports
----------------------------------------------------------------------
dockerlampteste_mysql_1 docker-entrypoint.sh mysqld Up
3306/tcp
dockerlampteste_php-5.6_1 docker-php-entrypoint php -a Exit 0
dockerlampteste_php-unit_1 /usr/local/bin/phpunit --help Exit 0
And when you run the command "docker ps" it appears that only the mysql image is running.