Inspect Container Images

LinuxLinuxBeginner
Practice Now

Introduction

As a system administrator, you need to be able to inspect container images to understand their contents and verify their integrity. This challenge will guide you through the process of inspecting container images using various tools and commands.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) linux/BasicSystemCommandsGroup -.-> linux/echo("`Text Display`") subgraph Lab Skills linux/echo -.-> lab-389458{{"`Inspect Container Images`"}} end

Inspect a Container Image

Tasks

  • Identify the base image of a container image
  • List the layers of a container image
  • Inspect the metadata of a container image
  • Verify the integrity of a container image

Requirements

  • Use the docker command-line tool to inspect the container image
  • The container image to be inspected is nginx:latest
  • Perform all operations in the /home/labex directory

Example

$ docker image inspect nginx:latest
[
  {
    "Id": "sha256:f7b3d4b7d8c5d5f7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d",
    "RepoTags": [
      "nginx:latest"
    ],
    "RepoDigests": [
      "nginx@sha256:4d8d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d"
    ],
    "Parent": "",
    "Comment": "",
    "Created": "2023-04-05T12:34:56.789Z",
    "Container": "4d8d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d",
    "ContainerConfig": {
      ...
    },
    "DockerVersion": "20.10.14",
    "Author": "",
    "Config": {
      ...
    },
    "Architecture": "amd64",
    "Os": "linux",
    "Layers": [
      "sha256:4d8d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d",
      "sha256:4d8d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d",
      "sha256:4d8d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d5c7f4c2c7d"
    ]
  }
]

Summary

In this challenge, you learned how to inspect container images using the docker image inspect command. You identified the base image, listed the layers, inspected the metadata, and verified the integrity of the nginx:latest container image. This knowledge is essential for understanding the contents and provenance of container images, which is a crucial skill for system administrators working with containers.

Other Linux Tutorials you may like