Docker containers for traditional Symfony 6.3.* web apps, i.e., apps that you would usually create using the --webapp
Symfony CLI option or the composer require webapp
command.
- Nginx webserver
- PHP 8.2 (with
composer
) - MySQL 8.0
- phpMyAdmin
- Clone the repo:
git clone https://github.com/TOA-Anakin/symfony-webapp-docker-dev.git
- Rename the cloned repo as desired:
mv symfony-webapp-docker-dev your_project_name
- Find your user ID using the
id -u
command and update the.docker/.env
file accordingly. cd
into the.docker
directory and build the Docker containers:Before the end of the process you should see a list of newly created (now running) containers:cd your_project_name/.docker docker compose up -d --build
[+] Running 6/6 ✔ Network symfony_webapp_docker_symfony_app Created 0.1s ✔ Volume "symfony_webapp_docker_db_app" Created 0.0s ✔ Container symfony_webapp_docker-phpmyadmin-1 Started 0.2s ✔ Container symfony_webapp_docker-php-1 Started 0.2s ✔ Container symfony_webapp_docker-db-1 Started 0.2s ✔ Container symfony_webapp_docker-nginx-1 Started 0.2s
- Open the terminal of the PHP container (mine is named
symfony_webapp_docker-php-1
) and create a Symfony skeleton project usingcomposer
:Move the contents ofdocker exec -it symfony_webapp_docker-php-1 bash composer create-project symfony/skeleton:"6.3.*" tmp_dir
temp_dir
into the project root:Install Symfony web app packages:mv tmp_dir/* . && mv tmp_dir/.[!.]* . && rmdir tmp_dir
Note: If you are prompted with a questioncomposer require webapp
Do you want to include Docker configuration from recipes?
, answern [No]
. - Access your Symfony web app at http://localhost, phpMyAdmin is accessible at http://localhost:8081