{"id":13443049,"url":"https://github.com/maxpou/docker-symfony","last_synced_at":"2025-04-08T11:09:27.907Z","repository":{"id":48888704,"uuid":"55516570","full_name":"maxpou/docker-symfony","owner":"maxpou","description":":whale: A docker multicontainer with NGINX, PHP7-FPM, MySQL and ELK (Elasticsearch Logstash and Kibana)","archived":false,"fork":false,"pushed_at":"2021-08-15T16:46:20.000Z","size":681,"stargazers_count":1303,"open_issues_count":34,"forks_count":468,"subscribers_count":75,"default_branch":"master","last_synced_at":"2025-04-01T09:32:00.570Z","etag":null,"topics":["docker","docker-compose","docker-symfony","mysql","nginx","php7","symfony"],"latest_commit_sha":null,"homepage":"http://www.maxpou.fr/docker-pour-symfony/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxpou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-05T14:50:28.000Z","updated_at":"2025-03-15T23:20:23.000Z","dependencies_parsed_at":"2022-09-16T04:12:02.976Z","dependency_job_id":null,"html_url":"https://github.com/maxpou/docker-symfony","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxpou%2Fdocker-symfony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxpou%2Fdocker-symfony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxpou%2Fdocker-symfony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxpou%2Fdocker-symfony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxpou","download_url":"https://codeload.github.com/maxpou/docker-symfony/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829491,"owners_count":21002995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","docker-symfony","mysql","nginx","php7","symfony"],"created_at":"2024-07-31T03:01:55.330Z","updated_at":"2025-04-08T11:09:27.868Z","avatar_url":"https://github.com/maxpou.png","language":"Dockerfile","readme":"# Docker Symfony (PHP7-FPM - NGINX - MySQL - ELK)\n\n[![Build Status](https://travis-ci.org/maxpou/docker-symfony.svg?branch=master)](https://travis-ci.org/maxpou/docker-symfony)\n\n![](doc/schema.png)\n\nDocker-symfony gives you everything you need for developing Symfony application. This complete stack run with docker and [docker-compose (1.7 or higher)](https://docs.docker.com/compose/).\n\n## Installation\n\n1. Create a `.env` from the `.env.dist` file. Adapt it according to your symfony application\n\n    ```bash\n    cp .env.dist .env\n    ```\n\n\n2. Build/run containers with (with and without detached mode)\n\n    ```bash\n    $ docker-compose build\n    $ docker-compose up -d\n    ```\n\n3. Update your system host file (add symfony.local)\n\n    ```bash\n    # UNIX only: get containers IP address and update host (replace IP according to your configuration) (on Windows, edit C:\\Windows\\System32\\drivers\\etc\\hosts)\n    $ sudo echo $(docker network inspect bridge | grep Gateway | grep -o -E '([0-9]{1,3}\\.){3}[0-9]{1,3}') \"symfony.local\" \u003e\u003e /etc/hosts\n    ```\n\n    **Note:** For **OS X**, please take a look [here](https://docs.docker.com/docker-for-mac/networking/) and for **Windows** read [this](https://docs.docker.com/docker-for-windows/#/step-4-explore-the-application-and-run-examples) (4th step).\n\n4. Prepare Symfony app\n    1. Update app/config/parameters.yml\n\n        ```yml\n        # path/to/your/symfony-project/app/config/parameters.yml\n        parameters:\n            database_host: db\n        ```\n\n    2. Composer install \u0026 create database\n\n        ```bash\n        $ docker-compose exec php bash\n        $ composer install\n        # Symfony2\n        $ sf doctrine:database:create\n        $ sf doctrine:schema:update --force\n        # Only if you have `doctrine/doctrine-fixtures-bundle` installed\n        $ sf doctrine:fixtures:load --no-interaction\n        # Symfony3\n        $ sf3 doctrine:database:create\n        $ sf3 doctrine:schema:update --force\n        # Only if you have `doctrine/doctrine-fixtures-bundle` installed\n        $ sf3 doctrine:fixtures:load --no-interaction\n        ```\n\n5. Enjoy :-)\n\n## Usage\n\nJust run `docker-compose up -d`, then:\n\n* Symfony app: visit [symfony.local](http://symfony.local)  \n* Symfony dev mode: visit [symfony.local/app_dev.php](http://symfony.local/app_dev.php)  \n* Logs (Kibana): [symfony.local:81](http://symfony.local:81)\n* Logs (files location): logs/nginx and logs/symfony\n\n## Customize\n\nIf you want to add optionnals containers like Redis, PHPMyAdmin... take a look on [doc/custom.md](doc/custom.md).\n\n## How it works?\n\nHave a look at the `docker-compose.yml` file, here are the `docker-compose` built images:\n\n* `db`: This is the MySQL database container,\n* `php`: This is the PHP-FPM container in which the application volume is mounted,\n* `nginx`: This is the Nginx webserver container in which application volume is mounted too,\n* `elk`: This is a ELK stack container which uses Logstash to collect logs, send them into Elasticsearch and visualize them with Kibana.\n\nThis results in the following running containers:\n\n```bash\n$ docker-compose ps\n           Name                          Command               State              Ports            \n--------------------------------------------------------------------------------------------------\ndockersymfony_db_1            /entrypoint.sh mysqld            Up      0.0.0.0:3306-\u003e3306/tcp      \ndockersymfony_elk_1           /usr/bin/supervisord -n -c ...   Up      0.0.0.0:81-\u003e80/tcp          \ndockersymfony_nginx_1         nginx                            Up      443/tcp, 0.0.0.0:80-\u003e80/tcp\ndockersymfony_php_1           php-fpm                          Up      0.0.0.0:9000-\u003e9000/tcp      \n```\n\n## Useful commands\n\n```bash\n# bash commands\n$ docker-compose exec php bash\n\n# Composer (e.g. composer update)\n$ docker-compose exec php composer update\n\n# SF commands (Tips: there is an alias inside php container)\n$ docker-compose exec php php /var/www/symfony/app/console cache:clear # Symfony2\n$ docker-compose exec php php /var/www/symfony/bin/console cache:clear # Symfony3\n# Same command by using alias\n$ docker-compose exec php bash\n$ sf cache:clear\n\n# Retrieve an IP Address (here for the nginx container)\n$ docker inspect --format '{{ .NetworkSettings.Networks.dockersymfony_default.IPAddress }}' $(docker ps -f name=nginx -q)\n$ docker inspect $(docker ps -f name=nginx -q) | grep IPAddress\n\n# MySQL commands\n$ docker-compose exec db mysql -uroot -p\"root\"\n\n# F***ing cache/logs folder\n$ sudo chmod -R 777 app/cache app/logs # Symfony2\n$ sudo chmod -R 777 var/cache var/logs var/sessions # Symfony3\n\n# Check CPU consumption\n$ docker stats $(docker inspect -f \"{{ .Name }}\" $(docker ps -q))\n\n# Delete all containers\n$ docker rm $(docker ps -aq)\n\n# Delete all images\n$ docker rmi $(docker images -q)\n```\n\n## FAQ\n\n* Got this error: `ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?\nIf it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.` ?  \nRun `docker-compose up -d` instead.\n\n* Permission problem? See [this doc (Setting up Permission)](http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup)\n\n* How to config Xdebug?\nXdebug is configured out of the box!\nJust config your IDE to connect port  `9001` and id key `PHPSTORM`\n\n## Contributing\n\nFirst of all, **thank you** for contributing ♥  \nIf you find any typo/misconfiguration/... please send me a PR or open an issue. You can also ping me on [twitter](https://twitter.com/_maxpou).  \nAlso, while creating your Pull Request on GitHub, please write a description which gives the context and/or explains why you are creating it.\n","funding_links":[],"categories":["Dockerfile","symfony"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxpou%2Fdocker-symfony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxpou%2Fdocker-symfony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxpou%2Fdocker-symfony/lists"}