Geavanceerd
Zoeken inHow-to-gidsen
Zo zoek je
  • Typ de taak in je eigen woorden (poort vinden, firewall openen, schijf vol) of plak een foutmelding tussen aanhalingstekens.
  • Kies "Snel antwoord" om alleen de commando's te zien, of een gebied om in één vakgebied te blijven.
  • "twee woorden" vindt precies die zin.
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken
Probeer:

How-to 147Containers · Registry

How to copy images between registries with Skopeo

Promote an image from the staging registry to production, mirror Docker Hub images into your own Harbor (rate limits, air-gapped sites), or check an image's digest without pulling gigabytes — Skopeo does all of it registry to registry, without a Docker daemon and without root. This how-to inspects, copies (all architectures), syncs a list of images, and works with credentials.

  • 5 Lessen
  • 5 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

147.1

The quick answer

skopeo inspect --format '{{.Digest}}' docker://registry.example.com/shop/api:1.4.2
skopeo copy --all docker://registry.example.com/shop/api:1.4.2 docker://registry-prod.example.com/shop/api:1.4.2
skopeo copy --all docker://docker.io/library/nginx:1.27 docker://harbor.example.com/mirror/nginx:1.27

--all copies every platform (amd64, arm64 …) of a multi-arch image, not only yours.

147.2

Step by step

  1. Install: dnf install skopeo / apt-get install skopeo (or the quay.io/skopeo/stable container).
  2. Log in to the registries (credentials are stored in ${XDG_RUNTIME_DIR}/containers/auth.json):
skopeo login registry-prod.example.com -u 'robot$shop+promote' --password-stdin < ~/.secrets/prod-token

Docker's ~/.docker/config.json logins work too.

  1. Inspect without pulling — digest, created date, platforms, labels:
skopeo inspect docker://registry.example.com/shop/api:1.4.2 | jq '.Digest, .Created, .Labels'
skopeo inspect --raw docker://docker.io/library/nginx:1.27 | jq '.manifests[].platform'
  1. Promote by digest — copy exactly the tested image:
D=$(skopeo inspect --format '{{.Digest}}' docker://registry.example.com/shop/api:1.4.2)
skopeo copy --all docker://registry.example.com/shop/api@$D docker://registry-prod.example.com/shop/api:1.4.2

Signatures and attestations (Cosign) are separate objects — copy them with cosign copy if you verify in production.

  1. Mirror many images with a sync file:
mirror.yaml
docker.io:
  images:
    library/nginx: ["1.27"]
    library/postgres: ["17"]
quay.io:
  images:
    prometheus/prometheus: ["v3.5.0"]
skopeo sync --all --src yaml --dest docker mirror.yaml harbor.example.com/mirror
  1. Offline / air-gapped — copy to a file, carry it, copy into the other registry:
skopeo copy --all docker://docker.io/library/alpine:3.22 oci-archive:alpine-3.22.tar
skopeo copy oci-archive:alpine-3.22.tar docker://registry.internal.example.com/mirror/alpine:3.22

147.3

Check that it worked

The digest in the target registry is the same as in the source (for the same platform list):

skopeo inspect --format '{{.Digest}}' docker://registry-prod.example.com/shop/api:1.4.2

147.4

Common problems

ProblemCauseFix
unauthorized / deniedNot logged in to that registry, or no push right.skopeo login; check robot account rights.
Target has only one architectureCopied without --all.Copy again with --all.
Digest differs after copyDifferent manifest format or not --all.Use --all; compare digests per platform if needed.
x509: certificate signed by unknown authorityInternal CA.Add the CA to the system trust, or --dest-cert-dir.
Docker Hub toomanyrequestsRate limit for anonymous pulls.Log in to Docker Hub; mirror once into your registry.
--format errorsTemplate field names are case-sensitive.{{.Digest}}, {{.Created}}, {{.Architecture}}.

147.5

Go further

1Why copy with --all?

To copy every platform of a multi-arch image, not only the one for your machine.

2How do you promote exactly the image you tested?

Copy it by digest (image@sha256:…), not by a tag that could change.

Alle commando's in dit hoofdstuk