Public | Automated Build

Last pushed: a year ago
Short Description
Docker symfony. Based on Vincent Chalamon version.
Full Description

Docker Symfony

A Dockerfile for Symfony Web container: Nginx, PHP-FPM…

Installation

Install Docker (Boot2docker or Kitematic for OS X & Windows).

Then, run following command to run container:

docker run -d -P marcinpiela/docker-symfony

Your project is available at http://127.0.0.1 (for Boot2docker, follow http://192.168.59.103).

Configuration

Want to integrate it with MySql ? I recommand to use Docker Compose.

Create docker-compose.yml file as following:

web:
    image: marcinpiela/docker-symfony:php7
    volumes:
        - .:/var/www
    net: "host"
    tty: true

mysql:
    image: mysql
    net: "host"
    environment:
        MYSQL_DATABASE: symfony
        MYSQL_USER: root
        MYSQL_ALLOW_EMPTY_PASSWORD: yes

Then run docker-compose up -d, your Symfony project is ready to access MySql through 127.0.0.1:3306.

Customize ports

By default, web container run on port 80, mysql container on port 3306. But in some case (for example to prevent ports conflicts on Linux),
you may need to use customize ports.

Let's imagine we'll run Nginx on port 8888, and MySql on port 3386. Update your docker-compose.yml file as following:

web:
    image: marcinpiela/docker-symfony:php7
    ports:
        - 8888:80
    volumes:
        - .:/var/www
    tty: true

db:
    image: mysql
    command: mysqld --port 3386
    net: "host"
    environment:
        MYSQL_DATABASE: erb_api
        MYSQL_USER: root
        MYSQL_ALLOW_EMPTY_PASSWORD: yes
Docker Pull Command
Owner
marcinpiela
Source Repository