This project has been replaced by Hexo
If you’re interested, see my latest post on using the site generator paired with markdown to create a more portable environment.
WordPress is a Content Management System (CMS) that is widely known for its flexibility and customization utilizing a basic blog structure of Pages and Posts. Using these two basic formats we can define the foundation of our website or blog and then build out posts and related content from there as needed. WordPress is open source, and is controlled through PHP statements and functions within our website or theme. Most users never see the raw HTML, PHP, or CSS simply because there is a wide range of themes available for free and purchase to suit most needs. If you plan to heavily customize your domain, you will likely need to dive into the code or have someone tweak it for you. In this way, the pre-built themes offered on WordPress provide opportunity to learn theme development.
WordPress also offers a wide range of official and third-party plugins to enhance your experience with the CMS. This benefits users heavily when the need for a custom interface or feature within WordPress is present. Most of the time, there is a plugin available to suit your needs – and if there isn’t, you may want to reconsider why you need the feature at all and take a different approach.
WordPress offers a mobile app capable of populating a news feed of followed blogs, and posting or editing content on your website on the go. This has proven to be a useful feature when out and about and realizing typos or grammar mistakes, they can be corrected within minutes from any smart phone or tablet. Backing up WordPress is proven to be as simple as backing up a database and zipping the appropriate folder within your web server’s root directory.
If you’re interested in using this yourself, be sure to check out the Official Wordpress Docker Image on DockerHub.
I chose to use Docker Compose to create the service in an organized configuration file opposed to running docker commands to start and connect Docker images. I heavily customized my configuration to my needs, binding custom volumes and scrambling ports where needed for security reasons. It is possible to practically copy the default docker-compose.yml on the official WordPress Docker Hub page, and spin up a container in a few minutes for proof of concept. You should never use default passwords or users given in any example docker-compose.yml file.
Once the container is running, you’ll need to configure your host’s web server to pass traffic to the container appropriately. To do this, I paired some basic DNS settings, NGINX, and Let’s Encrypt to terminate SSL on the box’s default web server and then pass the local traffic to the container where it can be handled internally and then encrypted on its way back out to the user for safe decryption on their end.
See the snippets below for a basic
docker-compose.yml to spin up your own WordPress, after the necessary modifications are made to the configs, of course.
Below, we have a simple docker-compose.yml for defining WordPress services -
Its important to note above that the volumes we define carry the syntax
local:container when defining the path to be mounted, and we don’t need to initialize any directories / configurations in general. When the container starts the first time, directories and files will be created and any volumes defined in the
docker-compose.yml used to create the service will be mounted so that the files on the container are available locally on the host. This is a useful tool to help ease the task of automating or scheduling backups and also makes the configurations on the container easier to modify using our local settings and packages.
# A simple nginx.conf showing how to pass traffic to a docker container