Wordpress in a Docker Container on an AWS EC2 Instance

Pretty much what the title is.

Spencer Pollock
5 min readFeb 6, 2020


Photo by Fabian Grohs on Unsplash

The example site that was created with these settings resides at: http://example.spollock.xyz

Lately, I’ve been messing around with Docker. I’ve wanted to work on setting up a Jenkins server (and it’s coming) with a Docker Swarm on a single machine. The goal is to have the single machine (also the master node) running the Jenkins server and running the slaves. All behind a reverse proxy. I’m at the stages now where Jenkins pipelines run and builds are done, but I haven’t got the swarm configured and working with Jenkins. Meanwhile, while I’m testing that, I’ve had a few interviews and calls with recruiters, so trying to remain busy and able to show what I’ve been actively learning, I set out to build a Wordpress server.

As I said, since I’m learning Docker and running more AWS EC2 instances to run them on, I want this to be similar to that. As I built this yesterday, I’m working out issues here and there, but as of now 48 hours after running the first, I have had no issues as of yet. Keep in mind, I’m only running 3 docker containers on the one host, and still learning more about the setup as I go so I will come back to modify this. My version templates also continue to grow, but I digress.

In this post, I will show you how I set about building my setup, and how you can do it yourself faster. You will be able to run this in the AWS free tier, as my server is also running on a t2.micro instance. I assume you have some knowledge in AWS console, but I’m also going to go through step by step to the best of my abilities.

1. Creating the first instance.

Head into AWS console and straight into the EC2 Dashboard. Go ahead and launch a new instance. With that instance, setup the following:

  1. Ubuntu server 16.04 LTS AMI
  2. t2.micro (1 core, 1G RAM)
  3. (Keep everything that is the default)
  4. 20GB SSD memory
  5. Tags (for personal referencing)
  6. Security group with ports (22, 80, 443) open to all. Name it “Wordpress”



Spencer Pollock

💻Software Engineer | Game Developer | DevOps | Project Enthusiest | Technical Writer — Working to make things simpler. I’ll tell you my story as it unfolds 📖