A Dockerfile that installs an Nginx / PHP-FPM based environment that also contains Solr 4, MariaDB, Redis, ElasticSearch and MailHog.
$ docker pull mariadb
$ docker run --name mariadb -e MYSQL_ROOT_PASSWORD=mysqlPassword -p 3307:3306 -d mariadb:latest
$ docker pull mailhog/mailhog
$ docker run -d -p 8025:8025 -p 1080:8025 --name mailhog mailhog/mailhog
Navigate to docker-php directory and run the build script.
$ docker build -t="citrussolutions/docker-php" .
With docker-compose you can easily configure the necessary settings for each site. This is done by copying the docker-compose.yml in this directory to your project root and checking the PLATFORM and port settings.
The port settings are defined for each project separately to expose necessary services to the host so that all the sites could technically be on simulatenously. The first HTTP port should be 8080, SSH port 2220, Solr port 8980 and ElasticSearch port 9200. It is advisable to assign the ports company-wide to allow easier co-operation.
You also need to add your public SSH key as the environment variable SSH_PUBLIC_KEY to either the docker_compose.yml file itself or as ~/docker.env.
After that, just run docker-compose up and it should work.
However, you always need to manually start the common containers:
$ docker start mariadb mailhog
Usually there should be no need to login to the Docker instance – all coding and Drush usage should happen on the host.
$ docker exec -it projectname_web_1 bash
In addition to a specified name, you can log in using the ID you can fetch with docker ps.
If you need to change the service configs, you can restart nginx / php5-fpm with the following (after logging in):
$ supervisorctl restart nginx