podman

Creating a Service Account to Access OpenShift Container Registry

Let’s say you want to create an OpenShift Container Registry account to be used by your CI/CD tooling. The recommended approach is to use a ServiceAccount instead of a regular user account. Here’s how you can do it.

First, create a ServiceAccount,

$ oc create serviceaccount david-susugigi-sa

Next, generate a token for this ServiceAccount. In this example, we create a long-lived token with a lifespan of two years

$ oc create token david-susugigi-sa --duration=16760h

eyJhbGciOiJ.....Gog8tY

Then, assign the appropriate role to the ServiceAccount

$ oc policy add-role-to-user system:image-builder -z david-susugigi-sa

Finally, use the ServiceAccount to log in to the registry, using the token as the password

$ podman login default-route-openshift-image-registry.apps-crc.testing \
      --tls-verify=false \ 
      -u david-susugigi-sa \ 
      -p eyJhbGciOiJ.....Gog8tY

Login Succeeded!

Unable to Start Podman on Mac

Just recently had below error when trying to run podman in my mac machine

$ podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
   Error: qemu exited unexpectedly with exit code 1, 
   stderr: qemu-system-x86_64: cannot create PID file: Cannot lock pid file: Resource temporarily unavailable

Workaround is quite simple, we can run this command

$ ps -edf | grep qemu-system | grep -v grep | awk '{print $2}' | xargs -I{} kill -9 {}; podman machine stop

And run podman again

$ podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users:/Users
Mounting volume... /private:/private
Mounting volume... /var/folders:/var/folders

Reference :

https://github.com/containers/podman/issues/16054

Where is the Location of Podman’s auth.json

There are times when we want to get the list of credentials that Podman is using, but sometimes it is hard to locate them.
The exact location would be vary depending on our userid, but it is pretty much straight forward.

For this sample im using 1005 as my userid. So the location of my credentials would be like this,

$ vi /run/user/1005/containers/auth.json

the result would be something like this

{
   "auths": {
		"docker.io": {
			 "auth": "xxxx="
		},
		"quay.io": {
			 "auth": "xxxx="
		}
   }
}