WordPress with Docker

Brijesh Dhanani
3 min readApr 19, 2020

--

As we know that WordPress is one of the most popular content management system (CMS). Running WordPress typically involves Apache, MySQL and PHP which is time-consuming. This is where Docker comes in to simplify the installation process. Installing WordPress with Docker is a breeze. Let’s see how you can set up Wordpress with docker??

What is docker?

Docker is an open-source instrument intended to make it simpler to make, convey, and show applications to utilizing holders. Docker is somewhat similar to a virtual machine that uses containers. Containers permit us to bundle up an application with the entirety of the parts it needs, for example, libraries and different conditions, and send it as one bundle. Thusly, because of the container, the designer can have confidence that the application will run on some other machine paying little heed to any altered settings that machine may have that could vary from the machine utilized for composing and testing the code.

Why should we use docker?

Many of you are thinking that why should we use docker. so the answer is using docker you don’t need xampp or any other big stack tools to be installed. All of you need to know is how to run docker containers. You only need to create one simple file with .yml or .yaml extension to set up the WordPress.

What is YAML?

YAML is basically a human-readable structured data format. It is the same as XML or JSON file but It is less complex than XML or JSON. It essentially allows you to provide all the powerful configuration settings like MYSQL, PHPMyAdmin, etc.

Let see step by step how to set up WordPress with docker.

Install Docker

First of all you have to install docker in your system. you can check documentation on https://docs.docker.com/ for installing docker in various systems like windows, ubuntu, Debian, mac, etc.

Create .yml or .yaml File

After successfully installing docker. Now, create docker-compose.yml or docker-compose.yaml. I have created docker-compose.yaml. Now, add all the required services you want to include inside your docker-compose.yaml file like DB which is for creating and managing database, WordPress for setting up WordPress, PHPMyAdmin for accessing and managing your PHPMyAdmin, etc.

Run Your Compose File

After adding all the details inside your docker-compose.yaml file open your terminal and run the following command.

docker-compose up -d

It will create a network with the name of your folder name, Volume, Database, etc. After running the above command you can see all the required folders and files of WordPress are added inside your folder.

Install Wordpress

open your browser and type http://localhost:8000. It will be taken to the WordPress installation page. Enter all the details like site name, username, password, email, etc. and click on install. That’s’ it you have successfully installed WordPress using docker.

If you want to access your PHPMyAdmin then simply type http://localhost:8080/phpmyadmin and enter your PHPMyAdmin username and password you have set inside your docker-compose file. You can see all the databases there.

Read more….

--

--

Brijesh Dhanani

👤 Software Engineer at Publicis Sapient, Singer, Blogger, React, JQuery, Node, Javascript. https://brdhanani.github.io