Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
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.
Step by step
- Install:
dnf install skopeo/apt-get install skopeo(or thequay.io/skopeo/stablecontainer). - 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-tokenDocker's ~/.docker/config.json logins work too.
- 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'- 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.2Signatures and attestations (Cosign) are separate objects — copy them with cosign copy if you verify in production.
- Mirror many images with a sync file:
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- Offline / air-gapped — copy to a file, carry it, copy into the other registry:
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.2Common problems
| Problem | Cause | Fix |
|---|---|---|
unauthorized / denied | Not logged in to that registry, or no push right. | skopeo login; check robot account rights. |
| Target has only one architecture | Copied without --all. | Copy again with --all. |
| Digest differs after copy | Different manifest format or not --all. | Use --all; compare digests per platform if needed. |
x509: certificate signed by unknown authority | Internal CA. | Add the CA to the system trust, or --dest-cert-dir. |
Docker Hub toomanyrequests | Rate limit for anonymous pulls. | Log in to Docker Hub; mirror once into your registry. |
--format errors | Template field names are case-sensitive. | {{.Digest}}, {{.Created}}, {{.Architecture}}. |
Go further
- Command pages: skopeo, buildah, jq, cosign.
- Next how-tos: Push an image to a private registry, Sign and verify an image with Cosign, Build images for ARM and x86.
- Full guides: Buildah and Skopeo, Harbor. Learn it: Docker — Registries, Images with Skopeo in DevOps.
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.