Dave Rendón Microsoft Azure MVP, embracing and fostering tech intensity to benefit society and thrive in a digital world.

How to install WordPress with Docker on Azure Linux VM

1 min read

Hey Folks, on this article we will review how to install WordPress with Docker on Azure Linux VM in this case using Ubuntu.

Here are the steps to follow to install WordPress with Docker on Azure Linux VM :

  1. Install Ubuntu VM with Docker on Azure
  2. Setup MariaDB on Docker
  3. Setup WordPress on Docker

So let´s jump into the detailed steps:

Install ubuntu VM with Docker

  1. Go to the Github repo and click on deploy to Azure https://github.com/daveRendon/ubuntuVM-docker

Then create a new resource group and provide the parameters for your Virtual Machine:

01 - How to install WordPress with Docker on Azure -wikiazure
02 - How to install WordPress with Docker on Azure -wikiazure

Then connect to your VM via SSH using putty

030 - How to install WordPress with Docker on Azure -wikiazure

Run the following update command for your system to make sure you have the latest source lists.

sudo apt-get update

Setup MariaDB on Docker

Before you install WordPress on Docker you will need to have a database to store the data like MySQL or MariaDB, in this case I will use MariaDB

1. Create new directory to store the files for WordPress and MariaDB.

mkdir ~/wordpress && cd ~/wordpress

04 - How to install WordPress with Docker on Azure -wikiazure

Now download and install a new MariaDB containcer instance. Please replace the MYSQL_ROOT_PASSWORD

docker run -e MYSQL_ROOT_PASSWORD=azurelatam -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest

05 - How to install WordPress with Docker on Azure -wikiazure

Confirm that the MariaDB container is running by using the following command:

docker ps -a

06 - How to install WordPress with Docker on Azure -wikiazure

Setup wordpress on Docker

Let´s pull the WordPress image using with the command below:

docker pull wordpress

07 - How to install WordPress with Docker on Azure -wikiazure

Not run the command below and replace the password, which is in this case “azurelatam”.

docker run -e WORDPRESS_DB_PASSWORD=azurelatam --name wordpress --link wordpressdb:mysql -p 80:80 -v "$PWD/html":/var/www/html -d wordpress

08 - How to install WordPress with Docker on Azure -wikiazure

Now go back to the Azure Portal and go to the “Overview” blade of the Ubuntu VM and browse to the DNS name or IP address in a web browser to test the installation

09 - How to install WordPress with Docker on Azure -wikiazure

Now you have a clean installation of the WordPress instance running on an Ubuntu Virtual machine with Docker.

010 - How to install WordPress with Docker on Azure -wikiazure

Dave Rendón Microsoft Azure MVP, embracing and fostering tech intensity to benefit society and thrive in a digital world.

Leave a Reply

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