Chapter 8 Using Skopeo to Inspect and Copy Images

This chapter explains how to use Skopeo to inspect and copy images between container storage types.

Skopeo is an optional utility that you can install in addition to Podman to inspect images in remote registries, and copy images between different types of OCI-compatible container storage. Skopeo does not require a running daemon to function.

Note

You do not need root permissions to run Skopeo commands. If you encounter errors, ensure that you have configured the appropriate proxy server settings, and that you have the necessary access permissions for the remote registries you are using.

For more information, see the SKOPEO(1) man page.

Inspect an image in a remote registry with Skopeo

Use the skopeo inspect command to inspect information about an image within a registry, such as when it was created, its SHA digest signature and environment variables set for the image. This can also be useful for inspecting alternate available tags for a matching image name within the registry. For example:

$ skopeo inspect docker://docker.io/library/oraclelinux:8-slim
{
    "Name": "docker.io/library/oraclelinux",
    "Digest": "sha256:410ddd2c0df85b96dc43af11530df8a7adc554e2a61b2645ff3893e53a6e6813",
    "RepoTags": [
        "5.11",
        "5",
        "6-slim",
        "6.10",
        "6.6",
        "6.7",
        "6.8",
        "6.9",
        "6",
        "7-slim",
        "7.0",
        "7.1",
        "7.2",
        "7.3",
        "7.4",
        "7.5",
        "7.6",
        "7.7",
        "7.8",
        "7",
        "8-slim",
        "8.0",
        "8.1",
        "8.2",
        "8"
    ],
    "Created": "2020-06-02T16:25:27.035497362Z",
    "DockerVersion": "18.09.7",
    "Labels": null,
    "Architecture": "amd64",
    "Os": "linux",
    "Layers": [
        "sha256:962e54b445ab56928c06f1d40aebe99a80b10b2bc428260bc931b24cec46e11c"
    ],
    "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ]
}

You can review the default configuration settings and build history for an image by adding the --config flag:

$ skopeo inspect --config docker://docker.io/library/oraclelinux:8-slim
{
    "created": "2020-06-02T16:25:27.035497362Z",
    "author": "Oracle Linux Product Team <ol-ovm-info_ww@oracle.com>",
    "architecture": "amd64",
    "os": "linux",
    "config": {
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Cmd": [
            "/bin/bash"
        ]
    },
    "rootfs": {
        "type": "layers",
        "diff_ids": [
            "sha256:4beda459d2bfe9960c5537dc4e04b43ffdc8f409897e092df2c0cc2094d82d31"
        ]
    },
    "history": [
        {
            "created": "2018-08-30T21:49:27.028879762Z",
            "created_by": "/bin/sh -c #(nop)  MAINTAINER Oracle Linux Product Team <ol-ovm-in...",
            "author": "Oracle Linux Product Team <ol-ovm-info_ww@oracle.com>",
            "empty_layer": true
        },
        {
            "created": "2020-06-02T16:25:26.6629159Z",
            "created_by": "/bin/sh -c #(nop) ADD file:336b... in / ",
            "author": "Oracle Linux Product Team <ol-ovm-info_ww@oracle.com>"
        },
        {
            "created": "2020-06-02T16:25:27.035497362Z",
            "created_by": "/bin/sh -c #(nop)  CMD [\"/bin/bash\"]",
            "author": "Oracle Linux Product Team <ol-ovm-info_ww@oracle.com>",
            "empty_layer": true
        }
    ]
}

For more information about the skopeo inspect command, see the SKOPEO-INSPECT(1) man page.

Copy an image between container storage types with Skopeo

Use the skopeo copy command to copy an image between registries without needing to download it locally first:

$ skopeo copy docker://docker.io/library/oraclelinux:8-slim \
   docker://example.com/os/oraclelinux:8-slim

If the destination registry requires a signature, provide the required key-id by using the --sign-by parameter.

You can also copy an image to your local Podman container storage by using the containers-storage: prefix:

$ skopeo copy docker://docker.io/library/oraclelinux:8-slim \
   containers-storage:oraclelinux:8-slim

To download an image and review its internal content offline you can specify a directory with the dir: prefix. For example, to extract to the oraclelinux folder in your home directory:

$ skopeo copy docker://docker.io/library/oraclelinux:8-slim \
   dir:/home/$USER/oraclelinux

In that example, the oraclelinux folder contains a manifest.json file and multiple tarballs representing the image that has been copied.

For more information about the prefixes and flags you can use, see the SKOPEO-COPY(1) man page.

Delete an image from container storage with Skopeo

Use the skopeo delete command to delete an image from a remote registry or your local container storage:

$ skopeo delete containers-storage:oraclelinux:8-slim

For more information about the skopeo delete command, see the SKOPEO-DELETE(1) man page.