Container development using Podman, Podman Desktop, and Kubernetes

Podman Desktop is a lightweight and efficient tool for managing containers and working with Kubernetes from your Windows, macOS, or Linux machine. From building container images to working with registries and deploying containers, Podman Desktop helps you seamlessly work with containerization technology, as well as simplifies the transition to container deployment on Kubernetes.

Access the Developer Sandbox

The quickest and preferred way to build an OCI image is at the command line. Use the podman build command and create the Python front end for this learning path.

Prerequisites:

In this lesson, you will:

  • Create a Linux image.

Step 1: Retrieve source code from Git repo

Run the following command to get the source code for the learning path:

git clone 
https://github.com/redhat-developer-demos/podman-desktop-sandbox-learning-path

Move into the resulting directory (podman-desktop-sandbox-learning-path).

Step 2: Build the image

The podman build command can be used to create a Linux image. When naming the image, it is a good idea to give the image a fully qualified image name, which includes the name of your image registry and your user name within that registry.

For example, you may have an account at quay.io under the name "foo", and if you wanted to name the image "bar", the result would be:

quay.io/foo/bar

In addition, it is suggested that you append a tag to an image name. The default value is :latest. For this learning path, we will be using a version designation, such as :v1.

Putting that all together would produce quay.io/foo/bar:v1.

With the values you need, run the following command to build the Linux image:

podman build -t {registry}/{username}/podify-demo-frontend:v1 .

Here’s an example:

podman build  -t quay.io/donschenck/podify-demo-frontend:v1 .

When the build finishes, you will have the image on your machine. You can prove this by running the following command:

podman images

Here’s an example:

C:>_ podman images
REPOSITORY                               TAG         CREATED
quay.io/donschenck/podify-demo-frontend  v1          30 minutes ago
<none>                                   <none>      30 minutes ago
<none>                                   <none>      30 minutes ago
registry.access.redhat.com/ubi9/ubi      9.2-755     14 months ago

Step 3: Push the image to your image registry

Before Red Hat OpenShift can deploy your image, the image needs to somehow make it into the OpenShift internal registry. While you can use the OpenShift internal registry as "our registry" by creating a route, a more common way is to push the image to a registry (such as quay.io or Docker Hub) and then pull it from there into OpenShift.

After logging in to your registry at the command line, run the following command using the values you determined in Step 2:

podman push {registry}/{username}/podify-demo-frontend:v1

Here’s an example:

C:>_ podman push quay.io/donschenck/podify-demo-frontend:v1
Getting image source signatures
Copying blob sha256:effef6fa43b2a8108f62d98a981b58b281ecd559a94e26479c89dd28424a59f
Copying config sha256:b94639ff9268618eccde9662420e60ae232b0a9d342339c25d29dc1233a029a
Writing manifest to image destination

Now the image is positioned where it can easily be imported into OpenShift. That comes in a later lesson.

Previous resource
Overview: Container development using Podman, Podman Desktop, and Kubernetes
Next resource
Start the two running containers