Hello future, meet Docker!

Docker containers

This is the first of many posts centered around docker and its marvelous uses in technology. As many of you know by now (i.e. 2018) the age of containers is already upon us taking over the other two historical periods (i.e Baremetal & VM) in OS deployments. The reason for this post is to present to the world a “hello world” equivalent to containerized applications and services. The primary focus will be on deploying a blog since that is the simplest and most useful platform for expression online. Furthermore, the readers of this blog would also get a practical benefit not just from learning how to deploy a blog but also about how docker containers interact with each other via ports. Let’s get started then.

WordPress blog on docker

The blog you see before you has been setup via docker-compose using WordPress, MySQL, Nginx and Let’s Encrypt. As you can imagine for most people this effort isn’t trival or well known. Well, I’m here to tell you that it’s as trivial as checking your email. The reason for this is because docker manages your configurations similarly to how gmail manages your emails. If you want to dive straight into the practical recipe check out https://github.com/ivandir/Ivandir.com_WordPress.

Deploy WordPress with docker-compose

For those of you that want to know all the details I’ll start breaking them down here line by line. In the end if you are still confused please leave a comment, otherwise if you are hungry for more knowledge head on over to https://docs.docker.com/compose/compose-file/.

Defining a docker-compose file for WordPress

Deploying WordPress using the docker-compose file

The deployment process provided that you have docker installed and docker-compose becomes very simple. After you’ve defined a docker-compose file, go to that directory and execute the following command.

Let’s define its arguments and explain what this command means. All the above command does is call the docker-compose executable giving it the order to create and start the containers.

Furthermore because you don’t want to deal with managing the containers, the following command puts them in a detached mode (i.e run containers in the background).

That’s all there is to it. Remember all you need to do is:

  1. Install docker
  2. Install docker-compose
  3. Define a docker-compose file
  4. Run docker-compose up -d command

Personal thoughts

On a more personal level this blog is also an avenue of expression, learning and self promotion. I’ll be as direct as a line between two points when expressing opinions and when detailing technological solutions as I see them. Don’t expect perfection, after all this is a blog and my time is limited but do expect practicality and diversity.


Leave a Reply

Your email address will not be published. Required fields are marked *