Docker Community Forums

Share and learn in the Docker community.

New on Docker & Symfony 4 Project

Hi everybody,

I’m a new docker user. Since 2 days i try to connect my symfony 4 project with doctrine & my docker-compose.

my problem :

And my docker-compose.yml

indent preformatted text by 4 spaces

version: ‘3.7’

services:
php:
build:
context: ./docker/php
volumes:
- ./:/srv/app
- ./docker/php/php.ini:/usr/local/etc/php/7.2/php.ini
restart: always

nginx:
depends_on:
- php
image: nginx:alpine
volumes:
- ./:/srv/app
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/csloisirs.conf:/etc/nginx/conf.d/default.conf
ports:
- 8084:80

db:
image: mysql:5.7
command: ["–default-authentication-plugin=mysql_native_password"]
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: csloisirs
MYSQL_USER: root
MYSQL_PASSWORD: root
ports:
- “3306:3306”

phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- “8080:80”
links:
- db

volumes:
db-data: {}

services:
php:
build:
context: ./docker/php
volumes:
- ./:/srv/app
- ./docker/php/php.ini:/usr/local/etc/php/7.2/php.ini
restart: always

nginx:
depends_on:
- php
image: nginx:alpine
volumes:
- ./:/srv/app
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/csloisirs.conf:/etc/nginx/conf.d/default.conf
ports:
- 8084:80

db:
image: mysql:5.7
command: ["–default-authentication-plugin=mysql_native_password"]
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: csloisirs
MYSQL_USER: root
MYSQL_PASSWORD: root
ports:
- “3306:3306”

phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- “8080:80”
links:
- db

volumes:
db-data: {}

and to finish my .env into my SF project :

DATABASE_URL=mysql://root:root@db/csloisirs

If you have any idea or if you can help me … thanks and have a nice day.