How to Install WordPress on Docker

 Hey Folks, in this tutorial we will show you how to install WordPress CMS through Docker. The only reason to install wordpress via docker is to reduce efforts. In this tutorial we will show two shortest ways through which you can install WordPress CMS in minimum time.

Let’s take a look 😛 !!

Install Docker

It is not that you should have knowledge of docker and you will get familiar with it after using it two or three times. To install wordpress CMS, we have to install the latest version of docker.io by using the apt command.

Docker is disabled by default, so we have to enable it using both of these commands.

Install the MariaDB Container ( Database )

Now we will download a new MariaDB images from docker registry using the docker pull command in the system.

Install WordPress CMS

The time has come to download the wordpress CMS from the docker registry using the below command.

Check Images

You can view all available or downloaded images in the docker using the following command.

  • Step: 1 Create a WordPress directory in the root folder.
  • Step: 2 Create a sub directory inside WordPress called “database”.
  • Step: 3 Create another sub directory inside a WordPress folder called “HTML”.

Activate MariaDB Database Server

Now we will create new MariaDB container along with database, user and password of mysql database server. You can change the database name and other configuration accordingly. After executing the command we check the availability of containers using the “docker ps” command.

Check Connectivity ( MySQL Database )

Connect to the MySQL database server using the below command to check connectivity or manage database.

Create WordPress CMS Container

Now we will start another new container for wordpress from the images by using the following command. Keep add the same database, user and password you created earlier.

Alright 😛 !! If the command is executed successfully, you can use the “docker ps” command to locate the WordPress web page. Copy the highlighted location and paste it on the browser.

Usage 😛 !! http://<localhost>:8081

WordPress Installation

After browsing the location, you have to select the language.

Great 😛 !! As you can see we did not need to enter database credentials as we had given earlier. After selecting the language we come to the following web page where we create administrative credentials.

Done 😛 !! Looks like everything is done. Let’s hit enter on the login button and access the admin panel.

Complete 😛 !! Now you can see that we have got the admin panel of WordPress CMS from where we can create our website and publish any content.

Install WordPress through Docker Composer

Let’s try to reduce the efforts. To install wordpress using docker in this method, we have to set up another dependencies of the docker using the following command.

Now create a file as per your own with .YML extension.

Paste the entire code below into the .yml file and save the configuration.

Source Code : https://docs.docker.com/compose/wordpress/

After executing the given command, all the services inside the .yml file will start along the given credential.

Hmm 😛 !! You can see that all the necessary services such as mysql and others are started automatically. Browse the highlighted location.

All you have to do is enter the username and password to secure the admin panel.

Wondering 😛 !! And that’s it, we have successfully installed WordPress CMS on our localhost web server using docker.

Tags : WordPress installation with docker | how to install wordpress with dockerinstall wordpress docker | install wordpress with docker compose |install wordpress docker | wordpress installation |

Post a Comment

أحدث أقدم