A docker multicontainer with NGINX, PHP7-FPM, MySQL and ELK (Elasticsearch Logstash and Kibana)

v2.1 2017-08-19 21:13 UTC


Build Status

ℹ️ This stack needs docker and docker-compose to be installed.


  1. Create a .env from the .env.dist file. Adapt it according to your symfony application

    cp .env.dist .env
  2. Build/run containers with (with and without detached mode)

    $ docker-compose build
    $ docker-compose up -d
  3. Update your system host file (add

    # UNIX only: get containers IP address and update host (replace IP according to your configuration) (on Windows, edit C:\Windows\System32\drivers\etc\hosts)
    $ sudo echo $(docker network inspect bridge | grep Gateway | grep -o -E '[0-9\.]+') "" >> /etc/hosts

    Note: For OS X, please take a look here and for Windows read this (4th step).

How it works?

Have a look at the docker-compose.yml file, here are the docker-compose built images:

  • db: This is the MySQL database container,
  • php: This is the PHP-FPM container in which the application volume is mounted,
  • nginx: This is the Nginx webserver container in which application volume is mounted too,
  • elk: This is a ELK stack container which uses Logstash to collect logs, send them into Elasticsearch and visualize them with Kibana.
  • redis: The Redis server container.

This results in the following running containers:

$ docker-compose ps
           Name                          Command               State              Ports            
dockersymfony_db_1            / mysqld            Up>3306/tcp      
dockersymfony_elk_1           /usr/bin/supervisord -n -c ...   Up>80/tcp          
dockersymfony_nginx_1         nginx                            Up      443/tcp,>80/tcp
dockersymfony_php_1           php-fpm                          Up>9000/tcp
dockers_redis_1      redis ...   Up      6379/tcp


Once all the containers are up, our services are available at: