Inspect Container Images

Red Hat Enterprise LinuxBeginner
Practice Now

Introduction

As a system administrator, inspecting container images is a fundamental skill for understanding their composition, contents, and trustworthiness. In this challenge, you will learn how to use the podman command-line tool to retrieve detailed, low-level information about a container image. This is a key competency for managing containerized environments effectively and securely.

Inspect a Container Image

In this challenge, you will learn how to inspect container images using the podman command-line tool.

Tasks

Your goal is to inspect the nginx:latest container image and extract specific pieces of information.

  • Execute the podman image inspect command on the nginx:latest image to display its detailed metadata.
  • Identify the Architecture and Os of the image from the command's output.
  • Find the list of Layers that compose the image's root filesystem.
  • Locate the RepoDigests to see the image's unique, verifiable identifier.

Requirements

  • All tasks must be performed using the podman command-line tool.
  • The target container image for inspection is nginx:latest.

Example

The command will produce a large JSON output. Below is a simplified and abbreviated example of the structure you should expect.

[
    {
        "Id": "sha256:f655a1ae999b8525e33a6800a833c84835e4533b4a1393df1066a935e3b390ac",
        "RepoTags": [
            "nginx:latest"
        ],
        "RepoDigests": [
            "nginx@sha256:2ab488493232f254773734a0f41a32b6e3999593338eda235760343c6138810c"
        ],
        "Parent": "",
        "Comment": "built by buildkit",
        "Created": "2024-04-02T13:58:45.99493299Z",
        "Config": {
            ...
        },
        "Architecture": "amd64",
        "Os": "linux",
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b41b647f50733393372724b2b96de3e5a50d745a61a338d3f51125596d05e489",
                "sha256:9e2f269c703a19a795f4431d24499a0918c8b501d21039a4861989a43ac1db71",
                "sha256:e25333e2432d31b420c3156b7448ff29113d11b65df089b4323f8d822551096a"
            ]
        }
    }
]

Hints

  • The podman image inspect command produces a large JSON output. You may need to scroll through your terminal to find the required information.
  • The output is a JSON array containing a single object, as you are inspecting one image.
  • Look for specific keys in the JSON output like Architecture, Os, RootFS, and RepoDigests.

Summary

In this challenge, you have learned how to use podman image inspect to dive deep into the configuration and composition of a container image. You practiced locating key information such as image metadata, layer digests, and repository digests. This skill is crucial for troubleshooting, security auditing, and ensuring you are working with the correct and untampered container images.

✨ Check Solution and Practice