WordPress with pod and containers

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Welcome, this post is about WordPress with pod and containers


They associate running pods with Kubernetes. And when they run containers in their development runtimes, they do not even think about the role pods could play even in a localized runtime. Most people coming from the Docker world of running single containers do not envision the concept of running pods. There are several good reasons to consider using pods locally, other than using pods to group your containers naturally.

Most attributes that make up the Pod are assigned to the “infra” container. For example, port bindings, cgroup-parent values, and kernel namespaces are all set to the “infra” container. This is critical to understand because once the Pod is created, these attributes are given to the “infra” container and cannot be changed. For example, if you make a pod and then later decide you want to add a container that binds new ports, Podman will not be able to do this. WordPress with pod and containers adding the new container, you must recreate the Pod with the additional port bindings.

For example, suppose you have multiple containers that require a MariaDB container. But you prefer not to bind that database to a routable network in your bridge or further. Instead, using a pod, you could attach to the Pod’s localhost address, and all containers in that Pod will be able to connect to it because of the shared network namespace.

Create Podman Pod

The first thing we need to do is create a pod using the podman Pod create command. In its most basic context, you can issue podman Pod create, and Podman will create a pod without extra attributes. A random name will also be assigned to the Pod:

[root@unixcop ~]$ sudo podman pod create

We can list the pods using podman pod ls or podman pod list command:

[root@unixcop ~]$ sudo podman pod ls
POD ID        NAME                     STATUS   CREATED        INFRA ID      # OF CONTAINERS
2a70ca9995f6  modest_goodall  Created  5 seconds ago  55db0c375e18  1

[root@unixcop ~]$ sudo podman pod list
POD ID        NAME                     STATUS   CREATED             INFRA ID      # OF CONTAINERS
3a70ca6665f6  modest_goodall  Created  About a minute ago  55db0c375e18  1

Add application container to Pod

You can add a container to a pod using the –pod option in the podman create and podman run commands.

[root@unixcop ~]$ sudo podman run -dt --pod unix_pod docker.io/library/alpine:latest top
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob ba3557a56b15 done  
Copying config 28f6e27057 done  
Writing manifest to image destination
Storing signatures

Create a pod for the WordPress and database.

# podman pod create --name wordpress -p 8181:80 -p 3306:3306

Create the database container

# podman run -dt --pod wordpress --name tesql -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress -e MYSQL_ROOT_PASSWORD=SQLp4ss -e MYSQL_DATABASE=wordpress registry.access.redhat.com/rhscl/mariadb-101-rhel7

Create the WordPress container

podman run -dt --pod wordpress --name wordpressins -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress -e WORDPRESS_DB_NAME=wordpress -e WORDPRESS_DB_HOST= docker.io/library/wordpress

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
Treat your password like your toothbrush. Don’t let anybody else use it, and get a new one every six months.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook