DEV Community

Discussion on: How to build a clean Docker Symfony 5.2 PHP8 PostgreSQL Nginx project

Collapse
 
sjiamnocna profile image
Šimon Janča

Hi, great article! Struggling with Docker for a while and looking for sources so thanks.

Now, few questions

  • in docker-compose.yml the version number 3.8 tells me it's unsupported version, I'd use just integers like 3, that works
  • Nginx tells me it cannot access /var/log/nginx/error.log, so I'd put something like mkdir chmod and chown into the image
  • If the containers are up, so where I can access the application with browser on the host computer?
  • PHP tells me; doctrine don't support postgres driver but only ..., so I changed driver to pdo_psql instead in config/packages/doctrine.yaml

This is my first time I saw anything of Symfony, quite a mess :D :)

Collapse
 
nicolasbonnici profile image
Nicolas Bonnici • Edited

Hey there,

Yup this is an old post must write a "How to build a clean Docker Symfony 6.2 PHP8.1 PostgreSQL 14 Nginx project" post ;)

  • Not according to docker-compose documentation docs.docker.com/compose/compose-fi...

  • Storing error logs under a container is a bad practice. You need to store them outside containers like so or somewhere else like an external service

nginx:
container_name: nginx
build:
context: ./nginx
volumes:
- ./../symfony/:/var/www
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/sites/:/etc/nginx/sites-available
- ./nginx/conf.d/:/etc/nginx/conf.d
- ./logs:/var/log
depends_on:
- php-fpm
ports:
- "8080:80"
- "443:443"

  • Good if it's working, i usually use "pdo_pgsql" no problem with it

Stay tune but the version used here are clearly outdated.