See https://github.com/maxpou/docker-symfony
Docker-symfony gives you everything you need for developing Symfony application. This complete stack run with docker and docker-compose (1.7 or higher).
-
Create a
.env
from the.env.dist
file. Adapt it according to your symfony applicationcp .env.dist .env
-
Build/run containers with (with and without detached mode)
$ docker-compose build $ docker-compose up -d
-
Update your system host file (add symfony.local)
# on Windows, edit C:\Windows\System32\drivers\etc\hosts
-
Prepare Symfony app
-
Update app/config/parameters.yml
# path/to/your/symfony-project/app/config/parameters.yml parameters: database_host: db
-
Composer install & create database
$ docker-compose exec php bash $ composer install # Symfony2 $ sf doctrine:database:create $ sf doctrine:schema:update --force # Only if you have `doctrine/doctrine-fixtures-bundle` installed $ sf doctrine:fixtures:load --no-interaction # Symfony3 $ sf3 doctrine:database:create $ sf3 doctrine:schema:update --force # Only if you have `doctrine/doctrine-fixtures-bundle` installed $ sf3 doctrine:fixtures:load --no-interaction
-
-
Enjoy :-)
Just run docker-compose up -d
, then:
- Symfony app: visit symfony.local
- Symfony dev mode: visit symfony.local/app_dev.php
- Logs (Kibana): symfony.local:81
- Logs (files location): logs/nginx and logs/symfony