Work with podman

folowing example create pod and inside run container from image (https://hub.docker.com/r/jenkinsci/blueocean/) with jenkins and expose port 3333 and 50000.

create pod with name “my_pod” with published port 3333 and 50000.
PORT>3333 is for UI
PORT>50000 is for conecting jenkins agent(Its not needed fot this case)
We need to publish all ports now, can not add another ports later, when pod is already created.

$podman pod create --name my-pod -p 3333:8080 50000:50000

By default, the every created pod will have a container called infra. The infra container is in sleep mode and its purpose is to hold the namespaces associated with the pod to allow podman to connect other containers to the pod. (we can disable it when we createing pod by flag “–infra=false”)

list of pods

$sudo podman pod list

list of containers inside pod

$sudo podman ps -a --pod


delete of pod:

$podman pod rm my-pod -f

Start docker cointainer inside pod

podman container run \
  --name my-jenkins \
  --pod my-pod \
  --rm \
  --detach \
  --privileged \
jenkinsci/blueocean

we need copy initial password for jenkins with following command

$podman exec my-jenkins cat /var/jenkins_home/secrets/initialAdminPassword

open browser with addres http://localhost:3333/

We can also start jenkins with separate container without pod with persistent volume “jenkins-data”

 podman container run \
  --name my-jenkins \
  --rm \
  --detach \
  --privileged \
  --publish 3333:8080 \
  --publish 50000:50000 \
  --volume jenkins-data:/var/jenkins_home \
  jenkinsci/blueocean

for find out real location of volume “jenkins-data” we can use

podman volume inspect jenkins-data

Checking information about image without download this image localy

skopeo inspect docker://docker.io/jenkinsci/blueocean:latest

UI for managing podman

installation

$sudo dnf install cockpit cockpit-podman -y
$sudo systemctl enable --now cockpit.socket

and go to http://localhost:9090/podman

Leave a Reply

Close Menu