Podman vs Docker deploying a WordPress application
#docker #podman #container #kubernetes #wordpress

Podman vs Docker deploying a WordPress application

Container technology is the most popular tool used widely for the faster deployment of the application on to servers. There are 3 main tools available that provide these features as docker, podman, or cri-o. In this post, I will show you a demonstration of WordPress application using a docker and podman tool plus what extra benefits provided by the podman over docker.

Docker container works on the principle of client-server hence it is prone to several attacks fro the outer world that is the internet. It is also prone to be a single point of failure as a docker client is the one that actually contacts to docker server.

And due to this client-server architecture, there is a small kind of latency also occurs during the launching of the container.

Podman is another tool for containers, which works on the principle of a daemon less architecture that is there is no client-server architecture. Hence it provides us benefits over docker vulnerabilities. Along with this podman provides us an extra benefit of Kubernetes kind of application architecture.

Deploying WordPress using docker

The process I am using is as: ( We can also the docker-compose)

  1. Create a new network using docker for inter-connection of containers
docker create network backend --driver bridge

  1. Launch the database container in the previous network
docker run -dt --restart always -e MYSQL_ROOT_PASSWORD=mysql -e \

MYSQL_DATABASE=wordpress -e MYSQL_USER=wordpress \ 

-e MYSQL_PASSWORD=wordpress --name db --network backend mysql:5.7 

3. Launch the WordPress application in the previous network along with an expose of port 80

docker run -dt -p 8080:80 --restart always  -e WORDPRESS_DB_HOST=db:3306 \ 

-e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress \

-e WORDPRESS_DB_NAME=wordpress --name wp --network wp-mysql \

wordpress:latest

Now, if you are running on the virtual machine then go the VM IP address:8080 or if you are running on top of cloud then use cloud public IP address:8080 and your wordpress application would be running.

In the case of cloud, you have to first open up or allow 8080 port to be accessible. ( More detail on this topic is not covered in this post )

Deploying WordPress using podman

In this, there are two ways in which we can deploy the application. First is the same way as we used for docker, except that it uses podman or make use extra benefits of podman that is creating a pod.

And here I will use the second approach and steps are:

  1. Create a pod that is used to maintain the isolated namespace to preserve the network for the containers
podman pod create --name wordpresspod -p 8080:80

To see if it is created or not use the command: podman pod ps

2. Launch the database application inside this pod

podman run -dt --restart always --pod=wordpress \

-e MYSQL_ROOT_PASSWORD=mysql -e \

MYSQL_DATABASE=wordpress -e MYSQL_USER=wordpress \ 

-e MYSQL_PASSWORD=wordpress --name db --network backend mysql:5.7 

3. Launch the wordpress applications inside this pod

podman run -dt --restart always  -e WORDPRESS_DB_HOST=localhost \ 

-e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress \

-e WORDPRESS_DB_NAME=wordpress --name wp --network wp-mysql \

wordpress:latest


Here the container will connect to the localhost system to communicate as there is nothing like a separate network device for communication between the containers.

To see the status of the pods and containers associated with it, use the command:

podman pod ps --ctr-names and podman ps

Using the podman, we can also create a YAML file for the Kubernetes so that the same application as the pod can be executed on top of Kubernetes too. To do so, use the command as

podman generate kube <pod-name> >> myPod.yaml

Now, we have two options to use this file, one to use it to deploy the wordpress application on top of Kubernetes or second to again use it as a pod for some kind of testing.

To use it as pod again use the command,

podman pod play kube myPod.yaml
No alt text provided for this image


Now two create pods using podman, there are further two ways as using two different kinds of network namespace that is rootless and rootful. To get more information go through the podman documentation or click here

If you have any doubts, please feel free to drop me a message. I will definitely try to resolve your doubts.

要查看或添加评论,请登录

Kritik Sachdeva的更多文章

  • Cephadm | Part-1

    Cephadm | Part-1

    In this small article, I will be covering a one of most of important component and critical component of ceph "cephadm"…

    3 条评论
  • Kubernetes Custom Controller Part-2

    Kubernetes Custom Controller Part-2

    This is a second blog of a two part series for the custom k8s controller. If you have no idea or knowledge about the…

  • Kubernetes Custom Controllers part-1

    Kubernetes Custom Controllers part-1

    What is a Controller? And what is a custom controller? Controller is an application or feature in k8s that looks up for…

    6 条评论
  • Deep dive into Ceph Scrubbing

    Deep dive into Ceph Scrubbing

    Definition Scrubbing is a mechanism in Ceph to maintain data integrity, similar to fsck in the file system, that will…

    13 条评论
  • "Ceph" a new era in the Storage world Part-1

    "Ceph" a new era in the Storage world Part-1

    Ceph is a Software Defined Storage solution created by Sage Weil in 2003 as part of his Ph.D project in California.

    6 条评论
  • Integration of Iscsi Storage with openshift | Part-2

    Integration of Iscsi Storage with openshift | Part-2

    Hi guys, in this post I will cover the iscsi server setup and how to automate it with ansible and use cases of…

    1 条评论
  • Configure HA Cluster on top of AWS using terraform and ansible

    Configure HA Cluster on top of AWS using terraform and ansible

    In this post, I will cover only the setting up of the HA cluster, not the resource creation part. So let's start with…

  • Storage Integration with Openshift

    Storage Integration with Openshift

    In this post, I am gonna show you how to integrate some of the storage solutions with openshift. And for the…

  • Amazon Kubernetes as a Service

    Amazon Kubernetes as a Service

    Why we need Aws to run our Kubernetes? What is Kubernetes? and so on..

    2 条评论
  • Basic Example to explain the Workflow of DevOps using webserver

    Basic Example to explain the Workflow of DevOps using webserver

    In companies, three different teams are working in parallel to push the application into the production world, so that…

社区洞察

其他会员也浏览了