Wordpress and Docker Tutorial

Using docker allows us to run all of our project straight in our own machine in just a couple of commands. It is the most comfortable and portable way to use wordpress in both development as well as production environments.


In Hamro we have always reccommended to use docker for any system development. Today we are going to learn how to set up a docker wordpress environment to work in a wordpress


If you haven't got docker installed, or don't know what docker is, we suggest you take a look at our tutorial on how to do that.

setting up a new website from scratch using the official wordpress docker

Create a new folder and create this docker-compose.yml in it. We will allow for persistance so that we can access the files directly from our operating system by setting the volumes to folders inside our working directory. This way we can simply move the folder to a USB drive and install our site anywhere or back it up.

The process to do this from scratch is extremely simple. Just head towards your ipaddress:8080 (by default localhost) and voilá. follow the instructions in site and you'll have it

wordpress screenshot

If you now want to migrate your current website , we suggest you use Updraft-plus. A very simple and powerful way to migrate your site. You can also simply swap the files inside the /wordpress folder by the ones in your website, and update the SQL database with your site's SQL database. The local setting's database userbase password is the ones you used in your docker-compose.yml

backing up your site and installing it in your development environment

First of all, install Updraft plus in your website. Once the plugin has been installed, activate it and head to Settings -> Updraft plus. You now simply need to click on "Backup now". On the modal, make sure you check both checkboxes to include all files in your backup.

wordpress screenshot

Wait for the system to create the backup (it might take a few minutes if your website is big enough) And then download each of the files into your system 

wordpress screenshot

Install Updraft plus in your wordpress development site and upload the files from before via the User Interface. The plugin will warn you about renaming the database site and tell you to upgrade to migrator (which is a pay-for software with many advantages). However we will not need to purchase migrator.  For now simply follow the steps until the site prompts you to relogin. When you try to do so, you will realize that your login is redirecting you to your original site.

wordpress screenshot
wordpress screenshot

Now if you try to use your site, you will notice it is broken. Don't panic. Head to your favorite SQL explorer and access the database container. Access the table wp_options​.  Make sure you change the siteurl and the home option_names to your ipadress:8080 (in my case it was localhost).

wordpress screenshot

After this the site will be working properly. Remember that the access credentials will now be the ones you used to have for your original site and not the ones you used to create the development environment.

Our reader's favorite picks

Joomla Docker Tutorial - Create your first joomla docker container

Creating a Joomla Docker container.

Leave review
In this tutorial we are going to learn how to set up a docker container and...
Read More
Lamp Docker Tutorial

LAMP Docker Tutorial

Leave review
Today we bring you a small pill of knowledge with the hand of Docker for we...
Read More
If you want to work remote then don't make these mistakes!

If you want to work remote then don't make these mistakes!

Leave review
Read More
Telegram Creator acuses Whatsapp of having backdoors for syping

Telegram Creator acuses Whatsapp of having backdoors for syping

Leave review
According to Durov, Whatsapp has never been secure and it has been done lik...
Read More
How app development works in developing countries

How app development works in developing countries

Leave review
Read More
This is what your UI should learn from videogames

This is what your UI should learn from videogames

Leave review
The videogame industry moves over one billion dollars on a yearly basis. It...
Read More
Suscribe to our mailing list

What is this about?

Our latest posts.

Joomla vs Wordpress

Joomla vs Wordpress

Leave review
In Hamro Dev we are experts in both Joomla and Wordpress, and in today's po...
Read More
How to use docker and wordpress

Wordpress and Docker Tutorial

Leave review
Using docker allows us to run all of our project straight in our own machin...
Read More
Using Redis and Node js 101

Node and Redis via Docker

Leave review
In this tutorial we are going to learn how to set up a small redis developm...
Read More
Answering tricky interview JS Questions

Answering tricky interview JS Questions

Leave review
This is a small comprendum of the sort of questions you may find in a Javas...
Read More
Lamp Docker Tutorial

LAMP Docker Tutorial

Leave review
Today we bring you a small pill of knowledge with the hand of Docker for we...
Read More

Related topics

Our categories.