docker-compose.yml
...
version: '2.1'
volumes:
dbdata: null
services:
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
entrypoint: docker-files/app/entrypoint.sh
volumes:
- './:/var/www'
links:
- db
- redis
depends_on:
db:
condition: service_started
redis:
condition: service_started
web:
build:
context: ./
dockerfile: web.dockerfile
volumes_from:
- app
ports:
- '8080:80'
links:
- app
db:
image: 'mysql:5.7'
volumes:
- 'dbdata:/var/lib/mysql'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: grabid
ports:
- '33061:3306'
redis:
image: redis
ports:
- "6379:6379"
# for debugging purposes
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- db
links:
- db
ports:
- '4040:80'
# testing
phpunit:
image: vcarreira/phpunit
command: -c phpunit.xml
volumes:
- './:/var/www'
links:
- db_test
depends_on:
db_test:
condition: service_started
db_test:
image: 'mysql:5.7'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: grabid_test
ports:
- '33062:3306'
phpunit.xml
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_HOST" value="db_test"/>
<env name="DB_DATABASE" value="grabid_test"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
Отдельная база нужна для тестирования.
Проблема (как я полагаю) в том, что две базы не могут работать на одном 3306 порту
Ошибка - Connection refused
Кто делал что-то подобное ?