Giter VIP home page Giter VIP logo

symfony-docker-compose's Introduction

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

Requirements

How to install this in my project?

  • cd to-your-project
  • git clone https://github.com/kasteckis/symfony-docker-compose.git
  • mv ./symfony-docker-compose/.docker ./.docker
  • mv ./symfony-docker-compose/Makefile ./Makefile
  • mv ./symfony-docker-compose/docker-compose.yml ./docker-compose.yml
  • mv ./symfony-docker-compose/docker-compose.xdebug.yml ./docker-compose.xdebug.yml
  • rm -rf ./symfony-docker-compose
  • docker compose up

How to access everything?

By default you can access services via:

  • Access your project website via - http://localhost/
  • MySQL can be accessed via localhost:3306
  • PhpMyAdmin can be accessed via http://localhost:81
  • Mailhog can be accessed via http://localhost:8025/ (SMTP Port is 1025)
  • Access docker apache-php terminal by writing - docker exec -it project_web bash (or make ssh)

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_DSN=smtp://user:pass@mailhog:1025 (You can you any user 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.