Podman


Podman

Create pod manually

The first thing to be done is the creation of a new pod. # sudo podman pod create -n my-app -p 8081:80

And then add a container to a pod sudo podman run -dt --pod my-app -v /opt/http:/usr/share/nginx/html:ro --security-opt="seccomp=unconfined" --name hello-nginx nginx

Notice that you can not run a container that binds a port to a container that runs in a pod. You have to bind the port to the pod instead, and there is an issue when you try to export multiple ports in a pod.

You can list all pods by

# sudo podman pod ps 
If you stop a pod, all containers in the pod will be stopped as well. 
$ sudo podman pod stop my-app 
$ sudo podman ps -a 

Installation of Podman on RHEL8


sudo yum module enable -y container-tools:1.0 
sudo yum module install -y container-tools:1.0 

Podman and wordpress

podman pull wordpress

podman pull mariadb

podman images

podman ps -a

podman logs containerid

podman pod list

podman pod create --name mypod -p 9100:80

podman volume create wordpress-data

podman volume create mariadb-data

podman run --pod=mypod --name mariadb -v mariadb-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=wordpress -e MYSQL_USER=admin -e MYSQL_PASSWORD=admin -d 

this will generate output with  a container say 3a3(containerid)

podman run --pod=mypod --name wordpress-web -v wordpress-data:/var/www/html -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=wordpress -e MYSQL_USER=admin -e MYSQL_PASSWORD=admin -d 

this will generate output with  a container say bc5(containerid)

if the container has exited then find out the container id and start it using

podman start containerid

podman stop containerid

remove container using 

podman rm containerid

access wordpress setup using http://localhost:9100

when setting up wordpress use 127.0.0.1:3306 in the configuration screen you have to specify database port number if u just use localhost in the connection field it doesn't work

Jenkins Installation

Create the following volumes to persist the Jenkins data using the following docker volume create commands:

podman volume create jenkins-data

Download the jenkinsci/blueocean image and run it as a container in podman using the following podman container runcommand

podman container run \ 
  --name jenkins-blueocean \ 
  --rm \ 
  --detach \ 
  --privileged \ 
  --publish 8080:8080 \ 
  --publish 50000:50000 \ 
  --volume jenkins-data:/var/jenkins_home \ 
  --volume jenkins-docker-certs:/certs/client:ro \ 
  jenkinsci/blueocean 


Check the Jenkins process is up and running 
[root@localhost ~]# podman ps 
CONTAINER ID  IMAGE COMMAND CREATED STATUS PORTS NAMES 
41be560345af  docker.io/jenkinsci/blueocean:latest  /sbin/tini -- /us...  4 seconds ago Up 4 seconds ago 0.0.0.0:8080->8080/tcp  jenkins-blueocean 
 
Copy the automatically-generated alphanumeric password from the Jenkins container location /var/jenkins_home/secrets/initialAdminPassword

[root@localhost ~]# podman exec -it 68d350997923 sh 
/ # cat /var/jenkins_home/secrets/initialAdminPassword 
c5b091551702478eb88bf887a154a64b 
podman logs 68d350997923