2 Command line

 

This chapter covers

  • The Podman command line
  • Running an OCI application
  • Comparing containers and images
  • Building an OCI-based image

Podman is an excellent tool for running and building containerized applications. In this chapter, you’ll get started by building a simple web application to demonstrate commonly used features of the Podman command line.

If you don’t have Podman installed on your machine, you can jump to appendix C, and then return here. This chapter assumes that Podman 4.1 or later is already installed. Older versions of Podman probably work fine, but all examples were tested with Podman 4.1. The example base image I use is the registry.access.redhat.com/ubi8/httpd-24 image.

Note

Universal Base Images (UBI) can be used anywhere, but container software maintained and vetted by Red Hat as well as run on a Red Hat operating system is fully supported. There are hundreds of Apache images that work similarly to this image that you can also try out.

Chapter 2 shows how Podman is a great tool for working with containers. In this chapter, I walk you through running the scenario you might use to build a containerized application. You launch a container, modify its contents, create an image, and ship it to a registry. Then I explain how you can do this in an automated way to maintain the security of your container image. Through it all, you will be exposed to many of the Podman command-line interfaces and get a good understanding of how to work with Podman.

2.1 Working with containers

2.1.1 Exploring containers

2.1.2 Running the containerized application

2.1.3 Stopping containers

2.1.4 Starting containers

2.1.5 Listing containers

2.1.6 Inspecting containers

2.1.7 Removing containers

2.1.8 exec-ing into a container

2.1.9 Creating an image from a container

2.2 Working with container images

2.2.1 Differences between a container and an image