Beginners guide to deploying Wordpress to Docker Containers on Oracle Cloud

Brian Mathews
6 min readJun 27, 2018

--

Intro

As the world DevOps and Containers has exploded in the last year, I thought it was time I give it a try for myself to see what the fuss is about.

If you haven’t used it or would like to find out more about docker first I recommend checking out Docker to see what it does :- https://www.docker.com/.

In short it gives your application a complete runtime and has everything needed for the application being bundled inside it. This run time is called a Container. These are not VM’s and they do not hold Operating Systems. Containers are made of efficient, lightweight, self-contained systems and guarantees that applications will always run the same, regardless of where it’s deployed.

For my first test with containers I thought I would try use a simple technology used by most Web developers and loved by most Website users, WordPress! Again if you are yet to know about it check here, https://wordpress.org/about/.

In short It’s a fully featured website builder and content management system that lets you create whatever web site you want.

And the third topic to introduce is Oracle Container Cloud Service, which is part of Oracle’s Platform As a Service (PaaS) offerings. It provides an easy and quick way to create an enterprise-grade container infrastructure. It delivers comprehensive tooling to compose, deploy, orchestrate and manage Docker container-based applications on the Oracle Public Cloud (Click here for more, https://cloud.oracle.com/en_US/container)..

Before we get started let me introduce you to a few key terms which we are going to use. So let’s define them first,

Service:
A service is a template for how to run a container from a single image and associated Docker runtime information (e.g. mapped ports, storage volumes etc…)

Stack:
A Stack is a template for how to run a container based application (e.g. a “WordPress” stack). Stacks typically consist of multiple containers. A stack is very similar and is also compatible with a Docker Compose format.

Deployment:
One or more running containers that have been created from deploying a Service or a Stack.

Deploy WordPress in Oracle Container Cloud

First login to your Oracle Cloud console and navigate to the Container service in the services menu:

Enter the service details as per follows. You can of course chose the Compute Shape your need for your requirements.

In the SSH Public Key Section click on Edit. You may opt to create a new key if already do not have one.

Once key created download the public key.

Make sure to unzip the downloaded file and can see the following keys.

Click Next and you brought to the confirmation page. Click Create.

The Container cloud service is now being provisioned.

When the service is fully provisoned you will see the Ready state.

Now on the Drop Down option of the Oracle Container Cloud Service/<Your Service Name> click on Container Console.

Enter your Username and password.

This opens container cloud service console. From here on we can create containers and services.

Click on Stacks on the left side menu. In the examples for the Container Cloud Service Stacks we have a WordPress Stack. Stacks are composed of multiple Services coupled with defined orchestration policies for deployment.

Click on edit on WordPress Singlehost Stack. The Stack graphical editor appeared.We can see each Service comprising the Stack, represented in the UI. It is possible to edit each Service individually. Click on Advanced editor.

This gives us a YAML editor if we want to edit something on the stack. Also provides the information on health checks it does.

Click Cancel on the Editor and on the Edit Stack page to return to the Stack page. Now click “Deploy” to deploy the WordPress App.

This opens a deployment settings page. If you want to change the way your container will be deployed you can do it here. For this demo we are using all the default settings. Click Deploy button.

The deployment will now start.

Wait until all checks have been passed for the db and WordPress application. This confirms that the container process is actually responding as well as being reported as running by the Docker Engine.

Click on YAML Tab to see port mapping through host to container.

On the Container tab, click on the hostname to find the public IP allocated. This will be used in browser to access Worpress.

Click on the hostname to get details as seen below.

In the browser navigate to http:// <Your IP>:8080/wp-admin/install.php to get the install page for WordPress.

From here you can install Wordpress to your specifications, to do so enter all required values and click Install WordPress.

Once the installation has been installed you will get a “Success!” message..

Click Login to Login to WordPress Application.

And you are ready to build your WordPress website on Docker hosted on Oracle Cloud.

Conclusion:

The ease of creating an application on containers is amazing, there is no worrying about VM’s or servers and it is so quick to do and using Oracle’s cloud platform made it really easy to get started with this.

The use of Oracle Clouds GUI for Containers made it very simple to orchestrate the Container deployment and alter the stacks where necessary.

Note:

Please note that this guide based on beginners, my follow up tutorials will cover more technical aspects of containerisation such as managing the underlying hardware, load balancing between containers and managing the database & caching layers.

--

--

Brian Mathews

Technical Consultant and Evangelist with a focus on Serverless and DevOps. Why not give Oracle Cloud a try with $300 free credits!https://bitly.com/mathewsbrian