Move the docker-compose.yml
and the folder named phpdocker
containing nginx and php-fpm config for it to the root of your Symfony4 project.
Ensure the webserver config on docker\nginx.conf
is correct for your project. For instance, for Symfony4 it should look for the public/index.php
, instead of the web/app.php
from Symfony2 and Symfony3
Note: you may place the files elsewhere in your project. Make sure you modify the locations for the php-fpm dockerfile, the php.ini overrides and nginx config on docker-compose.yml
if you do so.
Dependencies:
Once you're done, simply cd
to your project and run docker-compose up -d
. This will initialise and start all the containers, then leave them running in the background.
Note: you need to cd first to where your docker-compose.yml file lives.
docker-compose up -d
docker-compose up
. You will see a stream of logs for every container running.docker-compose stop
docker-compose kill
docker-compose logs
docker-compose exec SERVICE_NAME COMMAND
where COMMAND
is whatever you want to run. Examples:
docker-compose exec php-fpm bash
docker-compose exec php-fpm bin/console
docker-compose exec mysql mysql -uroot -pCHOSEN_ROOT_PASSWORD
Note: these are global commands and you can run them from anywhere.
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -a -q)
docker volume rm $(docker volume ls -q)
docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')
Disclaimer: This project has been generated on phpdocker.io