Skip to main content

Skopeo


Get Image Manifests

docker.io

skopeo inspect --raw docker://fluent/fluent-bit:3.2.1

registry.example.com

skopeo inspect --raw docker://registry.example.com/fluent/fluent-bit:3.2.1

Manifest Example

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:8ac8842561ed20d93088461e278c9c020af0b90fdf866a50342bff459ae42b05",
      "size": 4028,
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:1a96dc6ac0e21578ad5be472136bdb182c5109fabfc1993fce5e5c72c28930b4",
      "size": 4028,
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:edc1062470700e6f603b9154fee22ad1d4f93ab366f7727c3ec554b6fb5499b0",
      "size": 4028,
      "platform": {
        "architecture": "arm",
        "os": "linux",
        "variant": "v7"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:cd5956f4a07291f4f789b9fdbf6684a3e64ead8be4aa0c0c55075b0573451ddd",
      "size": 4028,
      "platform": {
        "architecture": "s390x",
        "os": "linux"
      }
    }
  ]
}

Copy Image

All Arch

Include manifest.

skopeo copy \
  --all \
  docker://otel/opentelemetry-collector-contrib:0.114.0 \
  docker://registry.example.com/otel/opentelemetry-collector-contrib:0.114.0
skopeo copy \
  --all \
  docker://fluent/fluent-bit:3.2.1 \
  docker://registry.example.com/fluent/fluent-bit:3.2.1
skopeo copy \
  --all \
  docker://opengauss/opengauss:5.0.0 \
  docker://registry.example.com/opengauss/opengauss:5.0.0

Specify Arch

  • Without manifest.
  • Specify --override-arch and --override-os.
  • Need to create manifest manually by docker command.
skopeo copy \
  --override-arch amd64 \
  --override-os linux \
  docker://fluent/fluent-bit:3.2.1 \
  docker://registry.example.com/fluent/fluent-bit:3.2.1-amd64
skopeo copy \
  --override-arch arm64 \
  --override-os linux \
  docker://fluent/fluent-bit:3.2.1 \
  docker://registry.example.com/fluent/fluent-bit:3.2.1-arm64

Create Manifest

docker manifest create \
  registry.example.com/fluent/fluent-bit:3.2.1 \
  registry.example.com/fluent/fluent-bit:3.2.1-amd64 \
  registry.example.com/fluent/fluent-bit:3.2.1-arm64

Push Manifest

docker manifest push registry.example.com/fluent/fluent-bit:3.2.1

Sync Image

skopeo copy 可以直接复制多架构镜像(Manifest List),而 skopeo sync 主要用于批量同步多个镜像,不适合处理单个镜像的多架构问题。

Pull Image

manifest-sha256 就是 manifest 对应架构里面的 hash

[root@master-1 ~]# nerdctl pull registry.example.com/otel/opentelemetry-collector-contrib:0.113.0
registry.example.com/otel/opentelemetry-collector-contrib:0.113.0:    resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:026bd68e5b1f646acd286fae257824f39629fe8b74df37b4c67d28f8ad8c4905:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:ff3b385fc8a4bc7709e2bd8b4024259b649f78732aecc874a963250b5a5c3dd4: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:1a1e862c66cbe5f9030bc2ca6a140544956e328f6d5a01d9c2a85f0f5cec0c08:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d103c5d8a019a36affb49174cc41b986f37ba9d4ca1c10d728fb1d2d32165571:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:9301cae3282a7339612daab271d3b195732c5f667258b5ddbb2a5de53a57e7f4:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:5b28bf9d2d1200cf14a4380eb536cca62e348f3f2121a03b67eed22700064df5:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 7.1 s                                                                    total:  70.8 M (10.0 MiB/s)