> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perform container management using commands such as podman and skopeo

> This guide explains how to manage container images using Skopeo alongside Podman, covering installation, inspection, copying, deleting, and synchronizing images.

In this guide, you'll learn how to efficiently handle container images using Skopeo—a powerful command-line utility that complements Podman. With Skopeo, you can manage container images and repositories directly without needing to download them onto your local disk.

## Installing Skopeo

Before you begin, ensure that Skopeo is installed on your system. If it's not already installed, you can set it up using YUM. This command installs Skopeo along with all its necessary dependencies:

```bash theme={null}
$ sudo yum install skopeo
```

<Callout icon="lightbulb" color="#1CB2FE">
  For other package managers and installation options, refer to the [official Skopeo documentation](https://github.com/containers/skopeo/blob/main/install.md).
</Callout>

## Inspecting Container Repositories

Skopeo allows you to examine remote container repositories without using local disk space. The `skopeo inspect` command retrieves a JSON output containing various details such as repository tags, creation date, Docker version, and system architecture.

For example, to inspect a Fedora image hosted on the Fedora registry, run:

```bash theme={null}
$ skopeo inspect docker://registry.fedoraproject.org/fedora:latest
```

The output will include information similar to:

```json theme={null}
{
  "Name": "registry.fedoraproject.org/fedora",
  "Digest": "sha256:655721ff6163ee7664126b5e05ae81598e1b0c3bcf7017c36c4472cb092fef9",
  "RepoTags": [
    "24",
    "25",
    "26-modular"
  ],
  "Created": "2020-04-29T06:48:16Z",
  "DockerVersion": "1.10.1",
  "Labels": {
    "license": "MIT",
    "name": "fedora",
    "vendor": "Fedora Project",
    "version": "32"
  },
  "Architecture": "amd64",
  "OS": "linux",
  "Layers": [
    "sha256:30887217d7b674cfobe64cd3fc00c25aab921cacf35fa0e7b1578500a3e1653"
  ],
  "Env": [
    "DISTTAG=f32container",
    "FGC=f32",
    "container=oci"
  ]
}
```

## Inspecting Container Configurations

Beyond repository details, Skopeo can also inspect the configuration of a container image. By using the `--config` flag with `skopeo inspect`, and piping the result through `jq`, you can view neatly formatted configuration details. For instance:

```bash theme={null}
$ skopeo inspect --config docker://registry.fedoraproject.org/fedora:latest | jq
```

This command outputs a detailed JSON summary of the container's configuration, including environmental variables, command information, and more:

```json theme={null}
{
  "created": "2020-04-29T06:48:16Z",
  "architecture": "amd64",
  "os": "linux",
  "config": {
    "Env": [
      "DISTTAG=f32container",
      "FGC=f32"
    ],
    "cmd": [
      "/bin/bash"
    ]
  },
  "Labels": {
    "license": "MIT",
    "name": "fedora",
    "vendor": "Fedora Project",
    "version": "32"
  },
  "rootfs": {
    "type": "layers",
    "diff_ids": [
      "sha256:4ac0fa2b217d3fd63d51e5a6fd59432e543d499cdf2b1ac48fbe424f2ddd1"
    ]
  },
  "history": [
    {
      "created": "2020-04-29T06:48:16Z",
      "comment": "Created by Image Factory"
    }
  ]
}
```

## Copying Container Images

Skopeo is not just for inspection—it also enables you to transfer container images across different storage mechanisms. Whether you're dealing with remote registries, local container storage backends, or OCI directories, Skopeo simplifies the process.

### Copying Between Registries

To transfer an image from a public repository to an internal enterprise registry, use the following command:

```bash theme={null}
$ skopeo copy docker://quay.io/buildah/stable docker://registry.kodekloud.com/buildah
```

### Copying from an OCI Layout Directory

If you need to copy an image from a local OCI layout directory to another local directory, this command will do the trick:

```bash theme={null}
$ skopeo copy oci:busybox_ocilayout:latest dir:myemptydirectory
```

## Deleting Container Images

Removing an image from a repository is straightforward with Skopeo’s `delete` command. Simply specify the image address to delete it:

```bash theme={null}
$ skopeo delete docker://localhost:5000/imagename:latest
```

<Callout icon="triangle-alert" color="#FF6B6B">
  Deleting images is irreversible. Ensure you have backups or are certain before executing the delete command.
</Callout>

## Synchronizing Registries

For maintaining consistency between registries, Skopeo offers a synchronization feature. This is especially beneficial when managing a local container registry that mirrors a remote repository. For example, to sync a remote registry with a local directory, run:

```bash theme={null}
$ skopeo sync --src docker --dest dir registry.kodekloud.com/busybox /media/usb
```

## Accessing Skopeo Man Pages

For comprehensive details about Skopeo and its various commands, the manual pages are an excellent resource. Use the `man` command to explore them.

To access the general Skopeo manual, run:

```bash theme={null}
$ man skopeo
```

This displays the manual which covers the tool’s overview, usage, and options. Here is an excerpt:

SKOPEO(1)                          August 2016                         SKOPEO(1)

NAME\
skopeo -- Command line utility used to interact with local and remote container images and container image registries

SYNOPSIS\
skopeo \[global options] command \[command options]

DESCRIPTION\
skopeo is a command line utility providing various operations with container images and container image registries.

Similarly, for information on specific commands such as copying images, inspect the dedicated man page:

```bash theme={null}
$ man skopeo-copy
```

This command details how to execute the `skopeo copy` operation, including its options and usage.

## Summary

Skopeo is a versatile tool that enhances container management by providing streamlined ways to inspect, copy, delete, and synchronize container images across various platforms. With seamless integration alongside Podman, managing container workflows becomes more efficient and flexible.

For further reading and advanced usage, consider exploring more resources:

* [Skopeo GitHub Repository](https://github.com/containers/skopeo)
* [Podman Documentation](https://podman.io/documentation)

By following the steps outlined in this guide, you can improve your container management strategies and streamline operations in your containerized environments.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/red-hat-certified-system-administrator-rhcsa/module/141c7a78-21ef-4dd8-86a3-fb0ef5037a8d/lesson/dc468105-88e9-4dba-8cf3-e98fc676e572" />

  <Card title="Practice Lab" icon="installation" cta="Learn more" href="https://learn.kodekloud.com/user/courses/red-hat-certified-system-administrator-rhcsa/module/141c7a78-21ef-4dd8-86a3-fb0ef5037a8d/lesson/1b588fdb-14cc-461a-93fb-81551aefbe35" />
</CardGroup>
