Skip to content

docker-compose.yml file and it's configuration dedicated for Symfony projects

Notifications You must be signed in to change notification settings

kasteckis/symfony-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symfony Docker Compose

Docker compose environment for Symfony (also works for Laravel or plain PHP) projects

Summary of what is included

  • PHP 8.2 with XDEBUG 3
  • Apache2
  • MySQL 8.0
  • PhpMyAdmin - manage MySQL
  • Mailhog - local mailing server
  • Installs composer command
  • Virtualhost configuration dedicated for Symfony projects

How to install this in my project?

  • Download .docker folder and docker-compose.yml file and add them to your project (Skip .github and public folders)
  • Run docker compose up command from your terminal. (Install docker compose)

How to access everything?

By default you can access services via:

Modifying .env file (If you are using Symfony)

If you use default IP addresses, append your .env file with the following:

  • For database connection -DATABASE_URL=mysql://project:project@mysql:3306/project
  • For mailing server - MAILER_URL=mailhog:1025//randomemail@gmail.com:randompassword (You can you any email and password)

MySQL

  • You can connect to your MySQL via localhost:3306
  • If you don't have any additional software, you can connect to database via phpmyadmin (http://localhost:81)
  • Username: project
  • Password: project
  • Default table is called project

Notes and common issues

  • I use this configuration on Windows 11 with WSL 2
  • You cannot use same container_name for multiple projects. Make sure to change them, or you can just delete that optional argument from docker-compose.yml file
  • You can't run multiple projects that allocate same ports on your localhost.
  • If you can't compose a new project, you might need to delete your old docker networks. Type docker network ls and then remove your old project network by writing docker network rm NETWORK_ID (for example docker network rm 528d8c753c17)
  • cannot start service XXX: network YYY not found. Open up container list with docker container ls -a and remove old containers with docker container rm ID.

Something does not work?

Please create an issue.