version: '3'
services:
db:
image: mysql:8.0.20
command: --default-authentication-plugin=mysql_native_password
volumes:
- "db_app:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
ports:
- 3306:3306
networks:
- symfony
php:
build:
context: .
dockerfile: docker/php/Dockerfile
args:
TIMEZONE: ${TIMEZONE}
volumes:
- ./symfony/:/Users/admin/Downloads/symfony-docker-master/symfony
networks:
- symfony
nginx:
build:
context: .
dockerfile: docker/nginx/Dockerfile
volumes:
- ./symfony/:/Users/admin/Downloads/symfony-docker-master/symfony
ports:
- 8050:8050
networks:
- symfony
volumes:
db_app:
networks:
symfony:
The application starts, connects to the database via
DATABASE_URL=mysql://user:123@db:3306/db
But when performing migrations through the console, I get the error
An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddr
esses: getaddrinfo failed: nodename nor servname provided, or not known
As I understand it, due to the fact that the address is specified in the connection db.
How to make migrations?
networksindocker-compose.yml?symfonynetwork in your case is redundant, because compose by default creates a bridge network which joins all your services