liveBook · Manning

Container image

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A packaged filesystem and application artifact containing the code, dependencies, and runtime requirements needed to create a container.

A container image is a shareable application artifact that bundles an application with its libraries, executables, configuration, and runtime requirements. It isolates this software from the host while normally sharing only the host kernel, making development, testing, and deployment more consistent. section 1.2.1 section 2.2.1

An OCI container image contains:

  • A root filesystem directory tree containing the software required by the application. section 1.2.3
  • JSON configuration describing the rootfs, executable, working directory, environment variables, maintainer, and identifying labels. section 1.2.3
  • A manifest list linking architecture-specific images so the same image name can resolve on different machines. section 1.2.3
  • Tar-packed layers and JSON files stored locally or in transports such as registries, OCI archives, and Docker archives. section 1.2.3 section 2.2.1

An image is not a running container. Podman pulls image layers into local container storage; then it combines image configuration, engine defaults, and user input into an OCI runtime specification. The runtime applies namespaces, cgroups, and security constraints before launching the container process. section 1.2.3 section 2.2.1

Pull, inspect, and run an image

Use `podman run -ti --rm registry.access.redhat.com/ubi8/httpd-24 bash` to pull an image when absent locally and open an interactive shell. `podman inspect` exposes configuration such as environment variables and the default command. Running the same image again reuses locally stored layers; omitting `bash` runs the image's default application, Apache HTTP Server. section 2.1.1

Build and share an image

Build images with `podman build` from a Containerfile or Dockerfile, then publish them with `podman push`. A manually committed image can be created with `podman commit`, but scripted builds are the usual approach because they make image creation repeatable and help maintain current, secure contents. section 2.3 section 2.2.4

$ podman image tree myimage
Image ID: 2c7e43d88038
Tags:   [localhost/myimage:latest]
Size:   461.7MB
Image Layers
├── ID: e39c3abf0df9 Size: 233.6MB
├── ID: 42c81bd2b468 Size: 20.48kB Top Layer of: [registry.access.redhat.com/ubi8:latest]
├── ID: 51a7beaa0b88 Size: 57.43MB
├── ID: 519e681b5702 Size: 170.6MB Top Layer of: [registry.access.redhat.com/ubi8/httpd-24:latest]
└── ID: bc3dcdefdac3 Size: 69.63kB Top Layer of: [localhost/myimage:latest localhost/myapp:latest]

Inspect an image layer tree to see how base images and later application changes combine into a reusable artifact. section 2.2.1

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains rootfs, JSON metadata, manifests, layers, transports, runtime conversion, and operational commands, stopping short of full image-building internals.
Examples
Uses UBI Apache images, image inspection, layer trees, Containerfiles, registry pushes, and microservice decompositions.
What it assumes
Assumes Linux and basic command-line use while introducing image, container, registry, rootfs, transport, and OCI terminology.
What you can do after
Operate/configure images with Podman by pulling, inspecting, running, building, pushing, tagging, comparing, and pruning them.
How it connects
Connects container images with containers, container registries, OCI, Linux namespaces, cgroups, microservices, volumes, and container runtimes.

Also explained in

Compare how 25 books explain container image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.