In the previous post Getting started with Docker Compose and WordPress we learned how to set up a WordPress website with Docker Compose. In this post, we’re going to populate that site with our content, and figure out how to deploy WordPress using Docker Compose. For the deployment target, we are going to use an AWS EC2 instance running Docker, You can learn how to configure that instance here.
In the last post we set up a docker environment on an EC2 instance, but we didn’t really explain what docker is all about or why we were doing this. In this one, we are going to dive deeper into Docker and Docker Compose and we’ll set up a local environment that works nearly identically to the one we’ve set up in AWS. With our environment set up, we will build a website with WordPress to deploy to the EC2 instance.
Amazon Web Services offers the Elastic Container Service which can be ideal for auto-scaling docker deployments with high availability, but there is a fair amount of setting up and it could get expensive. For simpler workloads, or just getting started you can install Docker inside of a single EC2 instance, and then use Docker Compose to manage the containers within. In this tutorial, we are going to walk through launching an EC2 instance with docker, docker-compose-cli, and git pre-installed, then we’ll connect to it over SSH to run some containers. We’ll conclude by navigating to the instance’s public DNS address in our browser, to see the output of the container that we have mapped to the host instance’s port 80.
To get started you will need an AWS account if you don’t have one you can sign-up here. If you do then go ahead and login to your console.
From there you want to head over to the EC2 Dashboard to create the EC2 instance.
Continue reading “Installing Docker and Docker Compose in AWS EC2 Instances”