Podman is a daemonless container engine to manage OCI containers. To run a set of containers for wordpress installation, below are the steps. To install podman in centos 8, you can refer here.
First you need to create a pod, so that the containers can talk to each other easily within the pod. Expose port 8080 for the pod to reach port 80 in the pod
# podman pod create --name mywordpress --publish 8080:80
Wordpress consists of 2 components, a wordpress front end and a database backend. We will create the backend first, using mysql image from dockerhub. Make sure to include the newly created container into our pod.
# podman run --detach --pod mywordpress \
-e MYSQL_ROOT_PASSWORD=1234 \
-e MYSQL_DATABASE=mywpdb \
-e MYSQL_USER=mywpuser \
-e MYSQL_PASSWORD=1234 \
--name mywpdb docker.io/mysql
We will then proceed to create a wordpress container. We will use 127.0.0.1 (localhost) as reference to our mysql container, because both containers are in the same pod.
# podman -run --detach --pod mywordpress \
-e WORDPRESS_DB_HOST=127.0.0.1 \
-e WORDPRESS_DB_NAME=mywpdb
-e WORDPRESS_DB_USER=mywpuser \
-e WORDPRESS_DB_PASWORD=1234 \
--name mywp docker.io/wordpress
Open a web browser, and browse to localhost:8080 (or <ip address>:8080), to get the wordpress installer wizard. Follow through the wizard to continue the wordpress installation.
No comments:
Post a Comment