Book Image

Build Your Own PaaS with Docker

By : Oskar Hane
Book Image

Build Your Own PaaS with Docker

By: Oskar Hane

Overview of this book

<p>Docker is a great tool in many ways for developers and people in DevOps.</p> <p>We begin by learning how easy it is to create and publish your own customized Docker images and making them available to everyone. We also see how practical it is to separate every service to its own container. When you have published separated service containers, the process of running all kinds of platforms in the same server for easier cloud computing is a walk in the park.</p> <p>This book walks you through a use case project that will teach you how to customize and create your own Docker image, allowing you to run any platform you want. The project evolves throughout the book and emerges as a complete three containers Wordpress/MySQL platform when finished.</p> <p>By the end of the book, you will know how to create such a container on a Wordpress/MySQL platform, among others.</p>
Table of Contents (15 chapters)
Build Your Own PaaS with Docker
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Our objective


To make this WordPress image useable for more than demo purposes, we need to modify the Dockerfile in three ways. Our objectives are as follows:

  • Preparing Apache for caching (through the WP Super Cache plugin)

  • Raising the upload limit in both PHP and Apache2

  • Installing two plugins: WP Super Cache and WP Mail SMTP

Preparing for caching

There are two small steps to be performed to obtain website caching through WP Super Cache—we need to enable the mod_headers and mod_expires modules in Apache2.

On line 5 in the Dockerfile, you can see RUN a2enmod rewrite. The a2enmod command enables modules in Apache2, and modules are disabled by the a2dismod command. Enabling our desired modules is as easy as appending them to that line:

RUN a2enmod rewrite expires headers

We make those edits, build a new image, and see what happens. It takes a long time to build these images, since PHP is built from source. What we are looking for are lines that state that our modules are enabled. They will show...