June 18, 2020 / Nirav Shah
WordPress (WordPress.org) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system, referred to within WordPress as Themes. WordPress was originally created as a blog-publishing system but has evolved to support other types of web content including more traditional mailing lists and forums, media galleries, membership sites, learning management systems (LMS) and online stores. WordPress is used by more than 60 million websites including 33.6% of the top 10 million websites as of April 2019 WordPress is one of the most popular content management system solutions in use WordPress has also been used for other application domains such as pervasive display systems (PDS)
Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.
Step 1
Launch a new server using AWS
Step 2
Login to your server
$ ssh -i key-pair.pem ubuntu@ip
Step 3
Update the server to get the latest version of packages installed in the server
$ sudo apt update && sudo apt upgrade -y
Step 4
Installing Docker itself is already easy.
$ sudo apt install docker.io
MariaDB in a container
Step 5
Before installing WordPress with Docker you will need to have somewhere to store the data. MariaDB is a community-developed relational database management system and a drop-in replacement for MySQL. It is officially available on Docker and provides easy instructions with up to date images.
Start off by making a new directory where you wish to store the files for WordPress and MariaDB for example in your home directory.
$ mkdir wordpress
$ cd wordpress
Step 6
Downloading and installing a new MariaDB container can all be performed with a single command. Before jumping in check the required parameters.
MariaDB Environment variables, these are marked in the Docker command with -e:
Step 7
You can confirm that the MariaDB container is running by using the following command:
$ sudo docker ps
Step 8
Check the status for your MariaDB install, it should show “Up” and the time it has been running like in the example output below.
Other useful commands for working with containers are ‘start’, ‘stop’ and ‘remove’.
$ sudo docker start $ sudo docker stop $ sudo docker rm
You can find out more about available commands and options to specific commands.
$ sudo docker --help $ sudo--help
Step 9
Applications in containers run isolated from one another in the userspace of the host operating system sharing the kernel with other containers. This reduces the overhead required to run packaged software while also enabling the containers to run on any kind of infrastructure. To allow applications within different containers to work with one another Docker supports container linking.
WordPress is also made officially available on Docker Hub, pull the image using the command below. When the version to download is not specified Docker will fetch the latest available.
$ sudo docker pull wordpress
Step 10
WordPress container also takes environment variables and Docker parameters:
Step 11
You can confirm that the WordPress container is running by using the following command:
$ sudo docker ps
Step 12
Check the status for your WordPress install, it should show “Up” and the time it has been running like in the example output below.
Step 13
Then open your server’s domain name or IP address in a web browser to test the installation. You should be redirected to the initial WordPress setup page at http:///wp-admin/install.php. Go through the setup wizard and you are done.
Also Read:
1. Step by Step Guide to Install WordPress on AWS for free
2. How to Migrate WordPress site to AWS with Cloudfront
FAQs:
1.Is Docker good for web server?
2.Can I run WordPress in a container?
As a Director of Eternal Web Private Ltd an AWS consulting partner company, Nirav is responsible for its operations. AWS, cloud-computing and digital transformation are some of his favorite topics to talk about. His key focus is to help enterprises adopt technology, to solve their business problem with the right cloud solutions.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.