Develop containers using 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, and simplifies the transition to container deployment on Kubernetes.

This learning path, created by Don Schenck, demonstrates how you can go from an initial application to a container to a fully running pod on Kubernetes using Podman Desktop and the no-cost Developer Sandbox for Red Hat OpenShift.

Access the Developer Sandbox

In Part 3 of this learning path, you will update the source code, build a new image, and run it on your local machine using Podman Desktop.

Step 16: Update the source code

Using the editor of your choice, change the file /templates/index.html in such a way that the change will be noticeable. For example, around line 16, you could change the text “Hello World! This website has been viewed” to something else (Figure 14).

Update the source code of our application and view the change.
Figure 14: Update the source code of our application and view the change.

Save the file, and we’ll proceed to rebuild the image in the next step.

Step 17: Rebuild your image

Previously, we used the command line to build the container image, but now, let’s use the Podman Desktop interactive GUI. From the right-hand side of the Images section of Podman Desktop, select Build an Image. Here, we’ll find the Dockerfile that we’re using in our project, and build the image using your own unique image name (Figure 15).

Select Build an Image from the right-hand side of the Images section of Podman Desktop.
Figure 15: Select Build an Image from the right-hand side of the Images section of Podman Desktop.

Step 17: Push the updated image to your image registry

With Podman already authenticated to your registry of choice, you should already have credentials and be able to push this image. On the right side of your built image, select the kebab menu, and you’ll be able to select the image to push to the registry (Figure 16).

On the right side of your built image, select the kebab menu and select the image to push to the registry.
Figure 16: On the right side of your built image, select the kebab menu and select the image to push to the registry.

Step 18: Replace the existing Python front-end container on your local PC inside Podman Desktop

Delete all of the existing containers in Podman Desktop. This will also remove the existing local pod. In Podman Desktop, select all containers, then click the delete button at the top of the panel (Figure 17).

To delete all of the existing containers in Podman Desktop, select all containers, then click the delete button at the top of the panel.
Figure 17: Remove all of the existing containers

Run the pre-loaded script:

  • If using Bash: 

    update the source code, build a new image, and run it on your local machine using Podman Desktop.
  • If using PowerShell: 

    ./preload.ps1 {image-name-goes-here}

Check your results

In order to make the image that you've created available to your sandbox, it must reside in your image registry. OpenShift will pull the image from there. Push the image to your registry using the podman push command. For example:

podman push quay.io/foobar/podify-demo-frontend:v1

Of course, for your command, you will replace the image path with your own. On the far right side of the row for the Python front-end container, select the Open Browser option from the kebab menu to view the front-end website in your browser.

Success alert: Checkpoint: At this point, you have a new version of the front-end application running on your local machine. Now it's time to deploy that new front-end version to your Developer Sandbox instance.

Previous resource
Deploy to the Developer Sandbox
Next resource
Deploy your front-end app to the Developer Sandbox