This is a basic stack for create y running Symfony project into Docker containers. Here are the docker-compose built images:
nginx
, acting as the webserver v1.21.php
, the PHP-FPM container with the 8.1 version of PHP. Xdebug is available by default.mysql
which is the MySQL database container with a MySQL 8.0 image.Clone this repository
Go inside folder ./docker
Edit environment variables in .env
file
NGINX_SERVER_NAME
is the server_name
used in NGINX.Build/run containers.
docker-compose build
docker compose up -d
You should work inside the php
container.
docker compose exec php bash
Check requirements for a Symfony application
symfony check:requirements
you will see the following output in the terminal
[OK]
Your system is ready to run Symfony projects
Create a new Symfony project
symfony new .
You Symfony project will be installed in /app
folder. Now you can access it from the browser through the domain that you have specified in the NGINX_SERVER_NAME
variable of the .env
file.
Available by default. Configure /docker/php/xdebug.ini
xdebug.mode=off
xdebug.start_with_request = no
xdebug.idekey=PHPSTORM
xdebug.start_with_request = yes
Project (/var/www/)
βββ docker
β βββ mysql
β βββ nginx
β βββ php
βββ app
βββ .. all symfony content