# Drupal on Docker ---  >"Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.” ---  --- # Container * Runtime environment for a process * Package < Docker image < VM * Isolation instead of virtualisation ^ packages: dependencies, post-install, tied to OS, hard to build --- # Images * Build from `Dockerfile` * Alternative build tools like Packer --- # Union file system  ^ Changes are incremental, runtime changes ephemeral --- # Deduplication  ^ saves disk space, speeds up build and launch --- # Volumes * files persist on the host * same lifetime as container * can be shared between containers --- # Use cases * Application container * Service container * Testing environment * Maintenance tools * Development environment --- # Docker for DevOps ^ Consistent environments for dev... and ops ---  --- # Example Dockerfile ## Preamble ``` FROM ubuntu:trusty MAINTAINER Jochen Lillich
``` --- # Example Dockerfile ## Install packages ``` RUN apt-get update && \ apt-get -y install \ apache2 \ && apt-get clean && \ rm -rf /var/lib/apt/lists/* ``` --- # Example Dockerfile ## Prepare runtime environment ``` RUN mkdir -p /var/run/apache2 RUN echo "ServerName localhost" \ >>/etc/apache2/apache2.conf RUN sed -i -e 's/^ErrorLog .*/ErrorLog \/dev\/stdout/' \ /etc/apache2/apache2.conf ``` --- # Example Dockerfile ## Set environment variables ``` ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/run/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid ``` --- # Example Dockerfile ## Connect to the outside world ``` VOLUME /var/www/html EXPOSE 80 ``` --- # Example Dockerfile ## Start the service ``` CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] ``` --- # Demo time! --- # Docker for Drupal * LAMP * Drupal code * Application setup --- ## But what about ## "single service"? --- # Demo time! ## Again! --- # Dockerfiles * https://github.com/freistil/freistil-docker-lamp * https://github.com/freistil/freistil-docker-drupal --- # Where to go from here * Compose * Swarm * Weave, Flannel * Flocker * CoreOS, Deis * Kubernetes --- # Thank you! ## jochen@freistil.it