Symfony development docker images

Leverage the power of docker to make development initialization easy. The goalis to have the members of your team ready to code very quickly :

Installing Docker

Installing Docker Compose

Running docker-compose up

For the moment there is :

an nginx image

a php-fpm image

a php-console image

a postgres image

a memcached image

a mailcatcher image

an elasticsearch image

All images are based on the same docker image : ubuntu:trusty, so that diskusage is not too high.

Setup inside a Symfony2 application

The project contains a sample Symfony2 application. You can do the same thingin your app.

Create a docker directory, in order to have a clean separation from the restof the project.

Create any configuration file needed by the containers you intend to use.Configuration files could be part of the image rather than mounted on it, that istrue, but having them as part of your application is great, because it makes explicitwhat will be needed when deploying the application.

Create a docker-compose.yml file and map the volume with paths on your host.

The containers

The nginx container

By default, defines a monitoring.* virtualhost. Try it, it displays nginx andphp-fpm status pages. There also is a coverage.* virtualhost, for phpunit users.It will serve files from /srv/build/coverage.

The php containers

There are three php images. The first one serves as a base for the two othersand you shouldn't use it. The two other are a php-fpm image, and a php-consoleimage. The php-console was named like this because there are other things thanthe php-fpm package on it : there also is nodejs, ruby-sass and otherdevelopment-related things, like composer or php-cs-fixer.

Both images come with XDebug remote debugging ready to use!XDebug will try to reach your DBGP client on 172.17.42.1:9000, please ensurethat your client is not only listening on localhost.You will also need to configure remote path mappings in your debugging clientso that the remote /srv folder is mapped to where your application is on yoursystem.

If you are using vim with vdebug, theconfiguration will look like this:

To run Composer, you might need to be able to authenticate against privaterepositories. To deal with that, log into the console container, and thengenerate a new pair of keys (ssh-keygen). Finally, associate the public keywith your account.

The mailcatcher container

Exposes an administration interface on port 80, and an SMTP service listeningon port 25.

DNS

Prerequisites

To use the DNS functionality, you have to run bin/docker-init. This scriptwill run a dns server and map it to your localhost. You might need to have alook at the documentation ofdnsdock if itdoes not work.

bin/docker-init

Configuration

In your docker-compose.yml file you can set DNSDOCK_NAME and DNSDOCK_IMAGEfor each image that you want to subscribe in DNS. Additionaly, you can set theDNSDOCK_ALIAS to completely bypass the basic naming scheme.