Skip to content

Run a Symfony application using Docker & docker-compose

Notifications You must be signed in to change notification settings

corretgecom/docker-symfony

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-symfony

Build Status

Just a litle Docker POC in order to have a complete stack for running Symfony into Docker containers using docker-compose tool.

Installation

First, clone this repository:

$ git clone git@github.com:eko/docker-symfony.git

Next, put your Symfony application into symfony folder and do not forget to add symfony.dev in your /etc/hosts file.

Then, run:

$ docker-compose up

You are done, you can visite your Symfony application on the following URL: http://symfony.dev (and access Kibana on http://symfony.dev:81)

Optionally, you can build your Docker images separately by running:

$ docker build -t symfony/code code
$ docker build -t symfony/php-fpm php-fpm
$ docker build -t symfony/nginx nginx

How it works?

Here are the docker-compose built images:

  • application: This is the Symfony application code container,
  • db: This is the MySQL database container (can be changed to postgresql or whatever in docker-compose.yml file),
  • 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.

This results in the following running containers:

> $ docker-compose ps
        Name                      Command               State              Ports
        -------------------------------------------------------------------------------------------
        docker_application_1   /bin/bash                        Up
        docker_db_1            /entrypoint.sh mysqld            Up      0.0.0.0:3306->3306/tcp
        docker_elk_1           /usr/bin/supervisord -n -c ...   Up      0.0.0.0:81->80/tcp
        docker_nginx_1         nginx                            Up      443/tcp, 0.0.0.0:80->80/tcp
        docker_php_1           php5-fpm -F                      Up      9000/tcp

Read logs

You can access Nginx and Symfony application logs in the following directories into your host machine:

  • logs/nginx
  • logs/symfony

Use Kibana!

You can also use Kibana to visualize Nginx & Symfony logs by visiting http://symfony.dev:81.

About

Run a Symfony application using Docker & docker-compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nginx 100.0%