Through the utilisation of Docker container technology, it is possible to effortlessly and expeditiously deploy programmes and packages on any operating system. It takes a significant amount of time to manually install WordPress. With the help of docker, we are able to streamline the installation procedure.
Follow the steps below.
1. Install the docker using below commands
yum update
yum install docker -y
systemctl start docker
2. Verify the installation with the below test program
docker run hello-world
Upon successful installation, the output will be as shown below:
3. Install MariaDB container with a single command as follows:
docker run -e MYSQL_ROOT_PASSWORD=pasword@123 -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest
where the parameters;
MYSQL_ROOT_PASSWORD = Database password
MYSQL_DATABASE = Database name
--name wordpressdb = Container name
-v "$PWD/database": = Set up a data directory linked to container storage.
-d = To run the container in the background
mariadb:latest = Database version
4. Install wordpress container using below commands:
docker pull wordpress
docker run -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=<password> --name wordpress --link wordpressdb:mysql -p 80:80 -v "$PWD/html":/var/www/html -d wordpress
where the parameters;
-e WORDPRESS_DB_PASSWORD= Use same database password used in above command
–name wordpress = Container name
–link wordpressdb:mysql = To link WordPress container with the MariaDB container
-p 80:80 = To pass connection from server HTTP port to container’s internal port 80.
-v “$PWD/html”:/var/www/html = Set up the WordPress files accessible from outside the container.
-d = To run the container in the background
WordPress = Install the package downloaded earlier with the docker pull command.
5. Verify that the containers are running using the below command:
docker ps
Status should show “Up” as output shown below:
6. Following that, open a web browser and navigate to your domain or IP address. Afterwards, you will be taken to the WordPress configuration page, which is depicted in the below screenshot. Now finalise the configuration in order to use your WordPress website.
The members of our Support Team are available to assist you with the installation of WordPress using Docker in the event that you experience any problems or glitches.