WordPress is a free, open-source, and widely used content management system. However, setting up a new web hosting environment with WordPress can be a time-consuming process. Docker simplifies the whole process with a few commands that reduce the time and effort needed for installation. Docker is an open-source containerization application built to develop, test, and run multiple applications on the same machine. It is very useful for developers to create a test environment without wasting server space and memory.
In this tutorial, we will show you how to install WordPress with Docker on Ubuntu 20.04.
A fresh Ubuntu 20.04 VPS on the Atlantic.net Cloud Platform
A root password configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.
apt-get update -y
Step 2 – Install Required Dependencies
First, you will need to install some dependencies in your server. You can install all of them by running the following command:
You should see the MariaDB container IP address in the following output:
Now, connect to your MariaDB container using the database user and password:
mysql -u wpuser -h 172.17.0.2 -p
You should see the following output:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.4-MariaDB-1:10.5.4+maria~focal mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Now, verify the database with the following command:
You should see your wpdb database in the following output:
| Database |
| information_schema |
| wpdb |
2 rows in set (0.001 sec)
Now, exit from the MariaDB shell with the following command:
Step 5 – Create a WordPress Container
First, download the WordPress image from the Docker repository using the following command:
Next, restart the Nginx service to apply the changes:
systemctl restart nginx
Step 7 – Access WordPress Interface
Now, open your web browser and type the URL http://wp.example.com. You will be redirected to the WordPress installation wizard:
Select your language and click on the Continue button. You should see the following screen:
Provide your site name, admin username, email, and password and click on the InstallWordPress button. Once the installation has been finished, you should see the following screen:
Provide your admin username and password and click on the Log In button. You should see the WordPress dashboard in the following screen:
In this guide, you learned how to install and configure WordPress in the Docker environment on Ubuntu 20.04. You can now set up WordPress in a test environment – get started today on VPS Hosting from Atlantic.Net!