Giter VIP home page Giter VIP logo

symfony-docker's Introduction

Docker Symfony (PHP7-FPM - NGINX - MySQL)

Build Status

Basic setup for developing Symfony applications. It runs with docker and docker-compose. It provides nginx, php7-fpm and mysql.

Installation

  1. Retrieve git project

    $ git clone [email protected]:florinutz/symfony-docker.git
  2. In the docker-compose file, add the path to your Symfony project

    services:
        php:
            volumes:
                - path/to/your/symfony-project:/var/www/symfony
  3. Build containers with (with and without detached mode)

    $ docker-compose up -d
  4. Update your host file (add foo.com)

    $ sudo echo "127.0.0.1 symfony.dev" >> /etc/hosts

Usage

Just run docker-compose up -d, then:

How it works?

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

  • db: the MySQL database container
  • php: the PHP7-FPM container in which the application volume is mounted
  • nginx: the Nginx webserver container in which application volume is mounted

This results in the following running containers:

$ docker-compose ps
Name               Command               State              Ports
----------------------------------------------------------------------------
mysql   docker-entrypoint.sh mysql ...   Up      0.0.0.0:3306->3306/tcp
nginx   nginx                            Up      443/tcp, 0.0.0.0:80->80/tcp
php     php-fpm                          Up      0.0.0.0:9000->9000/tcp

Useful commands

# bash commands
$ docker-compose exec php bash

# Composer (e.g. composer update)
$ docker-compose exec php composer update

# SF commands (Tips: there is an alias inside php container)
$ docker-compose exec php php /var/www/symfony/app/console cache:clear # Symfony2
$ docker-compose exec php php /var/www/symfony/bin/console cache:clear # Symfony3
# Same command by using alias
$ docker-compose exec php bash
$ sf cache:clear

# MySQL commands
$ docker-compose exec mysql mysql -udev -pdev

# Check CPU consumption
$ docker stats $(docker inspect -f "{{ .Name }}" $(docker ps -q))

# Delete all containers
$ docker rm $(docker ps -aq)

# Delete all images
$ docker rmi $(docker images -q)

FAQ

symfony-docker's People

Contributors

florin-lendico avatar

Watchers

Florin avatar James Cloos avatar

Forkers

flippr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.