PHP development environment with xdebug. Other services include:
- Apache
- Nginx
- Varnish
- MySQL
- PostgreSQL
- RabbitMQ
- ElasticSearch
- Redis
- Selenium
- Adminer
- MongoDB
- Varnish
- Mailhog
It uses docker-compose v3.7.
- Simply put contents of this repository in the root of your project
- Configure the
.env
file - Configure
docker-compose.yml
to use only the services you need - Run
docker-compose up -d
Supported versions: 5.6, 7.0, 7.1, 7.2, 7.3
Use Mailhog
Configuration can be changed using
docker/mysql/my.cnf
By default the data is stored in a named
container. You can change it to store
the data in a visible directory,
e.g. docker/data/mysql
By default the data is stored in a named
container. You can change it to store
the data in a visible directory,
e.g. docker/data/postgresql
Vhost configuration can be changed using
docker/nginx/vhost.conf
Vhost configuration can be changed using
docker/apache2/vhost.conf
Vcl configuration can be changed using
docker/varnish/default.vcl
By default the data is stored in a named
container. You can change it to store
the data in a visible directory,
e.g. docker/data/redis
By default the data is stored in a named
container. You can change it to store
the data in a visible directory,
e.g. docker/data/mongodb
By default the data is stored in a named
container. You can change it to store
the data in a visible directory,
e.g. docker/data/elasticsearch
RabbitMQ is available via web management console and from PHP container using ports defined in environment variables.
By default Selenium is included as a standalone Firefox container. Change it to Chrome if you want.
You have to set up environment variables for Blackfire
to be able to profile your app. You can profile the app
using web interface (Chrome extension) or via CLI using
blackfire
executable inside the PHP container.
Use docker-sync and external volume for sufficient speed on Mac
Useful Docker and Docker-compose commands
docker-compose up - starts containers
docker-compose up -d - starts containers in background (without showing logs)
docker-compose ps - lists all containers in current directory
docker-compose stop - stops all containers in current directory
docker-compose down - stops and destroys all containers in current directory
docker-compose exec <<container_name>> bash - logs into container as www-data
docker-compose exec -u root <<container_name>> bash - logs into container as root
Make sure to always run PHP commands inside PHP container as www-data - this way you will not encounter file permission problems.