Archive for the ‘Containers’ Category

Creating a WordPress Docker image

Your web site may not always be hosted on the same server. You may move to a new host or your current hardware may fail. Whatever the reason, being able to store you website within a container that can easily be moved from one server to another makes migration a snap.

In this tutorial I will guide you through creating a basic WordPress image.


The inmutable container

Docker containers are expected to be inmutable. This means that new content isn’t expected to be kept beyond the life of the container. There a lot of benefits to this, such as quickly and easily redeploying your wordpress after being defaced , for example.

Of course the problem with this is you are going to want to add site plugins, install themes, and upload images to your site. This is where data containers or local hosting volume mounting plays a key.

The strategy here will be to place all content that isn’t expected to change, such as our WordPress files, into a container and place all uploaded any frequently modified data in a separate container or on the local host.


The Docker File

To create our image we need to write a Dockerfile. This file defines how the image will created. We will define what  web server will be installed, where and how to install WordPress, and many other things.