Mariadb — Wordpress persistent database setup using Podman
we’re going to explain step by step how to use environment variables, set up persistent storage and perform a multi-container deployment of a WordPress application.
Wordpress — : It is a content management system (CMS) that allows you to host and websites. These open-source application written in PHP and paired with a MySQL or MariaDB database. Wordpress contains plugins architecture and a templet system, so you can customize any websites to fit your Blog, portfolio, and business.
Mariadb — : It is a popular open-source Relational Database created by original developers MySQL.
What are the Most Popular Relational Databases?
RDBMS allows Create, Read, Update, and Delete (CRUD) operations. Structured Query Language (SQL) is the language that is used to query, update, and delete data in relational database management systems (RDBMS). SQL language queries are also known as SQL commands or SQL statements.
If you want to learn more about RDBMS, check out What is RDBMS?
Here is the list of the top 10 most popular RDBMSs are:
Oracle, MySQL, SQL Server, PostgreSQL, IBM DB2,Microsoft Access, SQLite, MariaDB, Informix, Azure SQL
- Create Pod called wordpress
- Deploy mariadb existing pod and mount the volume
- Delpoy wordpress existing pod
- Check no. of pod, running containers and access the wp website
- To check persistent data
1. Create pod using Podman
Create a new pod called wordpress with port and hostname (Connect to the MariaDB server on the given host. The default host is
> podman pod create — name=<pod-name> — publish=<port-no.> — hostname=mysql
> podman pod ls ( verify the pod is created or not )
2. Deploy mariadb existing pod and mount the volume using Podman
Run a mariadb container in an existing <wordpress> pod with persistent storage.
> podman run -dit — pod wordpress — name mariadb-db -e MYSQL_USER=user -e MYSQL_PASSWORD=mypa -e MYSQL_DATABASE=sonam -e MYSQL_ROOT_PA SSWORD=rootpa -v mysql:/var/lib/mysql mariadb:latest
> podman ps ( To check container is successful created & running or not)
3. Deploy wordpress existing wordpress using podman
Run wordpress container in an existing wordpress pod
> podman run -dit — pod wordpress — name wordpress-db — e WORDPRESS_DB_HOST=mysql -e WORDPRESS_DB_USER=user -e WORDPRESS_DB_PASSWORD=myp a -e WORDPRESS_DB_NAME=sonam wordpress:latest
4. Check the number of container in pod and to see if both container is running
> podman pod ls and podman ps
Use browser to access the wordpress website
5. To check whether storage data is persistent or not
Create a blog and Publish it
Now, delete the Worpress container and then create a new-wordpress container .
Once container is deleted the wordpress website will go down.
Now create the wordpress container
Refresh the page.
Wow, we can see the same blog back and data is intact.
Hope this blog was helpful. Follow for more 😊