Skip to content
Hands-on IT IT Drills

Day 7: Your own registry and crane

Goal: You build your own registry with TLS and login, talk to its API with curl and edit images with crane directly in the registry – no pull, no build. · Duration: approx. 90 min · Prerequisite: Day 6

Briefing

  • A registry stores blobs (layers, config) and manifests in repositories. A tag is a name that points to a manifest; the digest is the SHA-256 of the content and changes with every byte.
  • An index (multi-arch) lists one manifest per platform. Every manifest names a config and the layers.
  • Today’s registry: registry:3.1.2 (CNCF Distribution), rootless with Podman, TLS via your own CA, login via htpasswd.
  • crane speaks the Distribution API directly: no daemon, no local storage.
 nginx:1.30.6-alpine ──► Index sha256:0e52… ─┬─► Manifest linux/arm64 sha256:4f7c…
                                             └─► Manifest linux/amd64 …   │
                                                       Config (= image ID) ◄┤
                                                       Layer 1 … 8 (blobs) ◄┘
 GET /v2/<repo>/manifests/<tag|digest>          GET /v2/<repo>/blobs/<digest>

Drill 1: Your own CA and server certificate

Start of the day, then a CA just for your lab and a certificate for registry.ct.lab.

source ~/ct-lab/setup/env.sh
mkdir -p ~/ct-lab/tag07 && cd ~/ct-lab/tag07
cp -R "$LAB/code/notes/." . && cp -R "$LAB/code/tag06/notes/." .
echo "$REG"
mkdir -p "$LAB/registry/certs" "$LAB/registry/auth" && cd "$LAB/registry/certs"
openssl req -x509 -newkey rsa:3072 -nodes -days 365 -subj "/CN=ct-lab CA ($USER)" \
  -keyout ca.key -out ca.crt 2>/dev/null
openssl req -newkey rsa:3072 -nodes -subj "/CN=$REG_HOST" \
  -keyout registry.key -out registry.csr 2>/dev/null
printf 'subjectAltName=DNS:%s\nextendedKeyUsage=serverAuth\n' "$REG_HOST" > ext.cnf
openssl x509 -req -in registry.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
  -days 90 -extfile ext.cnf -out registry.crt
openssl x509 -in registry.crt -noout -subject -issuer -ext subjectAltName -enddate
openssl verify -CAfile ca.crt registry.crt

Expected (abridged, IDs and times will differ on your machine):

registry.ct.lab:5000
Certificate request self-signature ok
subject=CN=registry.ct.lab
subject=CN=registry.ct.lab
issuer=CN=ct-lab CA (ubuntu)
X509v3 Subject Alternative Name:
    DNS:registry.ct.lab
notAfter=Jan 28 20:44:53 2027 GMT
registry.crt: OK
  • -x509 turns the request directly into a self-signed CA certificate.
  • Clients check the name in the SAN (Subject Alternative Name), not in the CN. Without subjectAltName, Go – and therefore crane, regctl, oras, containerd – rejects the certificate.

Save your progress? Sign up for free

Drill 2: Start the registry

Name, password file, then the container. The start script lives in the working directory, because you will need it again on Day 10 with a network argument:

grep -q " $REG_HOST\$" /etc/hosts || echo "127.0.0.1 $REG_HOST" | sudo tee -a /etc/hosts
getent hosts "$REG_HOST"
htpasswd -Bbn "$REG_USER" "$REG_PASS" > "$LAB/registry/auth/htpasswd"
head -1 "$LAB/registry/auth/htpasswd" | cut -c1-20
cd ~/ct-lab/tag07
cat > run-registry.sh <<'EOF'
#!/usr/bin/env bash
# run-registry.sh – Stand Ende Tag 7
# Startet die Registry rootless (neu); die Daten bleiben im Volume registry-data.
# Aufruf: ./run-registry.sh [netz]   (Tag 10: ./run-registry.sh kind)
set -euo pipefail
# shellcheck source=/dev/null
source "$HOME/ct-lab/setup/env.sh"
dir="$LAB/registry"
net=()
if [ -n "${1:-}" ]; then net=(--network "$1" --network-alias "$REG_HOST"); fi
podman rm -f registry >/dev/null 2>&1 || true
podman run -d --name registry "${net[@]}" -p "127.0.0.1:$REG_PORT:5000" \
  -v "$dir/certs:/certs:ro" -v "$dir/auth:/auth:ro" \
  -v registry-data:/var/lib/registry \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
  -e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
  -e REGISTRY_AUTH=htpasswd -e REGISTRY_AUTH_HTPASSWD_REALM=ct-lab \
  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
  docker.io/library/registry:3.1.2
EOF
chmod +x run-registry.sh && ./run-registry.sh | tail -1
podman ps --format '{{.Names}} {{.Image}} {{.Ports}}'
curl -sS "https://$REG/v2/"; echo "Exit: $?"

Expected (abridged):

127.0.0.1       registry.ct.lab
lab:$2y$05$N1ejsQJhg
6cb587078fba37f3ad4f3984e4fcdef6928e0162e33268e791b10d78e5aab649
registry docker.io/library/registry:3.1.2 127.0.0.1:5000->5000/tcp
curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer
certificate (20)
…
Exit: 60

htpasswd -B stores bcrypt, never the plain-text password. The registry is running, but curl does not know your CA. So it goes into the system certificate store – which curl, Podman, Skopeo and all Go tools read:

sudo install -m 0644 "$LAB/registry/certs/ca.crt" \
  "/usr/local/share/ca-certificates/ct-lab-$USER.crt"
sudo update-ca-certificates
curl -sS -i "https://$REG/v2/" | grep -iE '^(HTTP|www-auth|docker-dist)'
curl -sS -u "$REG_USER:$REG_PASS" "https://$REG/v2/"; echo
curl -sS -u "$REG_USER:$REG_PASS" "https://$REG/v2/_catalog"; echo

Expected:

Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
HTTP/2 401
docker-distribution-api-version: registry/2.0
www-authenticate: Basic realm="ct-lab"
{}
{"repositories":[]}

/v2/ is the entry point of the Distribution API: 401 with www-authenticate tells the client how to log in (Basic here, Docker Hub uses bearer tokens). {} means: logged in, API version 2. _catalog lists the repositories – none yet.

Save your progress? Sign up for free

Drill 3: Logins – who stores what where?

echo "$REG_PASS" | podman login -u "$REG_USER" --password-stdin "$REG"
ls -l "$XDG_RUNTIME_DIR/containers/auth.json"
jq . "$XDG_RUNTIME_DIR/containers/auth.json"
echo bGFiOmxhYi1yZWdpc3RyeS1wdy0xMjM= | base64 -d; echo
ls ~/.docker 2>&1

Expected:

Login Succeeded!
-rw------- 1 ubuntu ubuntu 96 Oct 30 20:45 /run/user/1000/containers/auth.json
{
  "auths": {
    "registry.ct.lab:5000": {
      "auth": "bGFiOmxhYi1yZWdpc3RyeS1wdy0xMjM="
    }
  }
}
lab:lab-registry-pw-123
ls: cannot access '/home/ubuntu/.docker': No such file or directory

Base64 is not encryption – the file is worth as much as the password. $XDG_RUNTIME_DIR lives in RAM (/run/user/1000): after a reboot, the Podman login is gone. And the other tools?

crane catalog "$REG"; echo "crane: $?"
regctl tag ls "$REG/notes/notes-api" 2>&1 | cut -c1-70
oras repo ls "$REG" 2>&1 | head -1

Expected:

crane: 0
failed to list tags for registry.ct.lab:5000/notes/notes-api:latest: no
Error: basic credential not found

Besides ~/.docker/config.json, crane also reads the Podman file (empty catalog, but exit 0). regctl and oras only know the Docker file. A login with crane creates it:

echo "$REG_PASS" | crane auth login "$REG" -u "$REG_USER" --password-stdin
jq -c . ~/.docker/config.json

Expected:

WARNING! Your credentials are stored unencrypted in '/home/ubuntu/.docker/config.json'.
Configure a credential helper to remove this warning. See
https://docs.docker.com/go/credential-store/

2026/10/30 20:47:25 logged in via /home/ubuntu/.docker/config.json
{"auths":{"registry.ct.lab:5000":{"auth":"bGFiOmxhYi1yZWdpc3RyeS1wdy0xMjM="}}}
Tool writes login to also reads
podman, buildah, skopeo $XDG_RUNTIME_DIR/containers/auth.json ~/.docker/config.json
crane, krane ~/.docker/config.json Podman auth.json
regctl (Day 8) ~/.regctl/config.json ~/.docker/config.json
oras, cosign (Day 9/14) ~/.docker/config.json –

From now on, every tool in the book finds your login. Anyone who shares the file or puts it in a backup shares the password.

Save your progress? Sign up for free

Drill 4: Push notes and the API by hand

for s in api web worker; do
  podman push -q "localhost/notes-$s:0.1.0" "$REG/notes/notes-$s:0.1.0"
done
A=(-sS -u "$REG_USER:$REG_PASS")
curl "${A[@]}" "https://$REG/v2/_catalog"; echo
curl "${A[@]}" "https://$REG/v2/notes/notes-api/tags/list"; echo
M="https://$REG/v2/notes/notes-api/manifests/0.1.0"
H='Accept: application/vnd.docker.distribution.manifest.v2+json'
curl "${A[@]}" -I -H "$H" "$M" | grep -iE 'content-type|docker-content-digest'
curl "${A[@]}" -H "$H" "$M" | sha256sum

Expected:

{"repositories":["notes/notes-api","notes/notes-web","notes/notes-worker"]}
{"name":"notes/notes-api","tags":["0.1.0"]}
content-type: application/vnd.docker.distribution.manifest.v2+json
docker-content-digest: sha256:9a22b91aff08798c7a7531ca483b799d2cde2492dbdf911f291c161d…
9a22b91aff08798c7a7531ca483b799d2cde2492dbdf911f291c161d4ffc7f23  -

The digest is literally the SHA-256 of the manifest – anyone can recompute it. podman push keeps the format of the build (--format docker since Day 1), hence the Docker media type. The manifest names the config, and it sits next to it as a blob:

C=$(curl "${A[@]}" -H "$H" "$M" | jq -r .config.digest); echo "$C"
curl "${A[@]}" -L "https://$REG/v2/notes/notes-api/blobs/$C" | sha256sum
curl "${A[@]}" -L "https://$REG/v2/notes/notes-api/blobs/$C" | jq -c '{architecture,
  User: .config.User, v: .config.Labels["org.opencontainers.image.version"]}'
podman image inspect localhost/notes-api:0.1.0 --format '{{.Id}}'

Expected:

sha256:0765d1019f4676ebd06a9055cfa442cd6d000689f5e2ba31be8fc998b89faf7b
0765d1019f4676ebd06a9055cfa442cd6d000689f5e2ba31be8fc998b89faf7b  -
{"architecture":"arm64","User":"65532:65532","v":"0.1.0"}
0765d1019f4676ebd06a9055cfa442cd6d000689f5e2ba31be8fc998b89faf7b

In Podman, the image ID is the config digest. The manifest digest, on the other hand, only comes into being at push time (layers get compressed in the process); podman push --digestfile datei writes it down as well.

Save your progress? Sign up for free

Drill 5: crane – install and read

Profile crane
Purpose Work on images and registries directly via the Distribution API
Special feature no daemon, no local storage; copies and modifies inside the registry
Project github.com/google/go-containerregistry (Apache-2.0)
Version in the book 0.22.1

The package contains three programs: crane, krane (Day 10) and gcrane (crane plus extras for Google registries such as gc and recursive copying – not installed in the book). You installed crane on Day 0; here it is once more with tools.lock:

arch=$(dpkg --print-architecture)
read -r _ _ url sum < <(grep "^crane $arch " "$LAB/setup/tools.lock")
curl -fsSLo /tmp/crane.tgz "$url"
echo "$sum  /tmp/crane.tgz" | sha256sum -c -
sudo tar -C /usr/local/bin -xzf /tmp/crane.tgz crane krane && rm /tmp/crane.tgz
crane version

Expected:

/tmp/crane.tgz: OK
0.22.1

Reading works without a login, even on Docker Hub. Which tags does nginx have, which ones for 1.30.6?

crane ls docker.io/library/nginx | wc -l
crane ls docker.io/library/nginx | grep '^1\.30\.6-alpine'
crane digest docker.io/library/nginx:1.30.6-alpine
crane digest docker.io/library/nginx:stable-alpine
crane digest --platform linux/arm64 docker.io/library/nginx:1.30.6-alpine

Expected:

1381
1.30.6-alpine
1.30.6-alpine-otel
1.30.6-alpine-perl
1.30.6-alpine-slim
1.30.6-alpine3.24
1.30.6-alpine3.24-otel
1.30.6-alpine3.24-perl
1.30.6-alpine3.24-slim
sha256:0e52bd054126cdc040b1276c0af347aeb02a41b9cfe305d6094767ac30e97949
sha256:0e52bd054126cdc040b1276c0af347aeb02a41b9cfe305d6094767ac30e97949
sha256:4f7cab9e1cd018f80e67f31e02dc0c6d18560b19504461c4f3dd37e5c63a74c5

stable-alpine and 1.30.6-alpine are the same image today – maybe not tomorrow. The digest stays. Without --platform you get the digest of the index, with --platform the one of the manifest for arm64. What does the index look like?

crane manifest docker.io/library/nginx:1.30.6-alpine > idx.json
jq -r '.mediaType, (.manifests | length)' idx.json
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(.platform.variant
  // "") \(.annotations["vnd.docker.reference.type"] // "-")"' idx.json | head -4
jq '.manifests[6] | {digest, mediaType, platform}' idx.json && rm idx.json

Expected:

application/vnd.oci.image.index.v1+json
16
linux/amd64 -
unknown/unknown attestation-manifest
linux/armv6 -
unknown/unknown attestation-manifest
{
  "digest": "sha256:4f7cab9e1cd018f80e67f31e02dc0c6d18560b19504461c4f3dd37e5c63a74c5",
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "platform": {
    "architecture": "arm64",
    "os": "linux",
    "variant": "v8"
  }
}

Eight platforms, plus eight attestation manifests (unknown/unknown): Docker Hub stores an SBOM and provenance with every build.

Warning: Docker Hub limits anonymous pulls (100 per hour and IP in the test). crane ls and crane digest (HEAD request) do not count, crane manifest (GET) does. That is why you copy nginx once in a moment and work locally afterwards.

Save your progress? Sign up for free

Drill 6: crane copy and config

time crane copy docker.io/library/nginx:1.30.6-alpine \
  "$REG/library/nginx:1.30.6-alpine" 2>&1 | tail -1
crane digest "$REG/library/nginx:1.30.6-alpine"
crane catalog "$REG"
N="$REG/library/nginx:1.30.6-alpine"
crane manifest --platform linux/arm64 "$N" \
  | jq -c '{mediaType, config: .config.digest[0:19], layers: [.layers[].size]}'

Expected:

2026/10/30 20:47:02 registry.ct.lab:5000/library/nginx:1.30.6-alpine: digest: sha256:0
e52bd054126cdc040b1276c0af347aeb02a41b9cfe305d6094767ac30e97949 size: 10317

real    0m21.063s
sha256:0e52bd054126cdc040b1276c0af347aeb02a41b9cfe305d6094767ac30e97949
library/nginx
notes/notes-api
notes/notes-web
notes/notes-worker
{"mediaType":"application/vnd.oci.image.manifest.v1+json","config":"sha256:71f44768e3
48","layers":[4190488,1901479,627,963,404,1211,1399,19858889]}

crane copy transfers all platforms including attestations blob by blob and leaves every byte unchanged – the digest in your registry is the same as on Docker Hub. The data flows through crane, nothing lands on disk. Now the config:

crane config --platform linux/arm64 "$N" | jq '{architecture, variant, created,
  config: .config | {Env, Entrypoint, Cmd, ExposedPorts, StopSignal},
  layers: (.rootfs.diff_ids | length)}'
podman image inspect docker.io/library/nginx:1.30.6-alpine --format '{{.Id}}'

Expected (abridged):

{
  "architecture": "arm64",
  "variant": "v8",
  "created": "2026-10-22T00:16:56.267286194Z",
  "config": {
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "NGINX_VERSION=1.30.6",
…
    ],
    "Entrypoint": [
      "/docker-entrypoint.sh"
    ],
    "Cmd": [
      "nginx",
      "-g",
      "daemon off;"
    ],
    "ExposedPorts": {
      "80/tcp": {}
    },
    "StopSignal": "SIGQUIT"
  },
  "layers": 8
}
71f44768e348d88b5e3ea14a77e0e082792bc46d283de47ef08249bd7ae2e223

Again: image ID in local storage = config digest in the registry. -v shows what crane sends over the wire in the process:

crane digest -v "$REG/notes/notes-api:0.1.0" 2>&1 | grep -E '(-->|<--)' \
  | cut -c21- | sed 's/ (.*//'

Expected:

--> GET https://registry.ct.lab:5000/v2/
<-- 401 https://registry.ct.lab:5000/v2/
--> HEAD https://registry.ct.lab:5000/v2/notes/notes-api/manifests/0.1.0
<-- 200 https://registry.ct.lab:5000/v2/notes/notes-api/manifests/0.1.0

Exactly the calls from Drills 2 and 4 – crane is a very convenient curl.

Save your progress? Sign up for free

Drill 7: pull, push, tag and delete

From now on, lab/ is your playground in the registry:

cd ~/ct-lab/tag07
crane pull "$REG/notes/notes-api:0.1.0" api.tar && tar -tf api.tar
crane pull --format oci "$REG/notes/notes-api:0.1.0" api-oci && ls api-oci
crane push api.tar "$REG/lab/notes-api:tarball" 2>/dev/null
crane push api-oci "$REG/lab/notes-api:oci" 2>/dev/null
crane tag "$REG/lab/notes-api:oci" stabil 2>/dev/null
crane ls "$REG/lab/notes-api"

Expected:

sha256:0765d1019f4676ebd06a9055cfa442cd6d000689f5e2ba31be8fc998b89faf7b
2f8852384d1b2d65d511677cf4bbe13190ec6619d81d7935942c229f5c19cacb.tar.gz
34a23a5bdaf142798f754d18fa12765aaaf79f520ee3968f1714a79cfcc2aaf0.tar.gz
manifest.json
blobs  index.json  oci-layout
registry.ct.lab:5000/lab/notes-api@sha256:9a22b91aff08798c7a7531ca483b799d2cde2492dbd…
registry.ct.lab:5000/lab/notes-api@sha256:9a22b91aff08798c7a7531ca483b799d2cde2492dbd…
oci
stabil
tarball

crane pull writes a tarball (for podman load) or an OCI layout (--format oci), crane push uploads either one again – with an identical digest. crane tag sets a tag without touching a single layer. And deleting?

crane delete "$REG/lab/notes-api:stabil"; echo "Exit: $?"
crane ls "$REG/lab/notes-api"
crane delete "$REG/lab/notes-api@$(crane digest "$REG/lab/notes-api:oci")"
crane ls "$REG/lab/notes-api"; echo "(leer)"
podman exec registry grep -A1 'delete:' /etc/distribution/config.yml

Expected:

Exit: 0
oci
tarball
(leer)
    delete:
      enabled: true
  • By tag, Registry 3.x deletes only that tag. By digest, it deletes the manifest – and with it all tags that point to it (oci and tarball).
  • The configuration in the image registry:3.1.2 already turns deletion on. Older guides set REGISTRY_STORAGE_DELETE_ENABLED=true for that – it is the same setting as an environment variable (storage.delete.enabled).

This is what a registry that forbids deletion looks like – briefly, without TLS, only on 127.0.0.1:5001:

podman run -d --name reg-nodelete -p 127.0.0.1:5001:5000 \
  -e REGISTRY_STORAGE_DELETE_ENABLED=false docker.io/library/registry:3.1.2 >/dev/null
sleep 2
crane copy --insecure "$REG/notes/notes-api:0.1.0" 127.0.0.1:5001/test:1 2>/dev/null
crane delete --insecure 127.0.0.1:5001/test:1; echo "Exit: $?"
podman rm -f reg-nodelete >/dev/null

Expected:

Error: DELETE http://127.0.0.1:5001/v2/test/manifests/1: UNSUPPORTED: The operation is
unsupported.
Exit: 1

Deleted manifests do not free up storage. Only garbage collection removes the blobs – in production with the registry stopped or read-only:

podman exec registry registry garbage-collect --dry-run \
  /etc/distribution/config.yml 2>&1 | grep 'blobs marked'

Expected:

133 blobs marked, 0 blobs and 0 manifests eligible for deletion

Nothing to free: the layers of lab/notes-api also belong to notes/notes-api.

Save your progress? Sign up for free

Drill 8: Change images without a build – mutate, append, export

crane copy "$REG/notes/notes-api:0.1.0" "$REG/lab/notes-api:0.1.0" 2>/dev/null
crane mutate "$REG/lab/notes-api:0.1.0" --label lab.tag=07 --env NOTES_LOG=debug \
  -t "$REG/lab/notes-api:0.1.0-mut" 2>/dev/null
crane config "$REG/lab/notes-api:0.1.0-mut" \
  | jq -c '.config | {Env, lab: .Labels["lab.tag"]}'
crane config "$REG/lab/notes-api:0.1.0" | jq -c '.config.Labels["lab.tag"]'

Expected:

registry.ct.lab:5000/lab/notes-api@sha256:ba71428aa0a172676289d606866805823269983bc55a…
{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NOTES_LOG
=debug"],"lab":"07"}
null

mutate writes a new config and a new manifest; the layers stay where they are. Without -t, crane would only push by digest. An additional layer comes with append – from an ordinary tar:

mkdir -p extra/etc/notes && echo "gebaut ohne Build: Tag 7" > extra/etc/notes/README
tar --owner=0 --group=0 -C extra -cf extra.tar etc
crane append -b "$REG/lab/notes-api:0.1.0" -f extra.tar \
  -t "$REG/lab/notes-api:0.1.0-extra" 2>/dev/null
crane manifest "$REG/lab/notes-api:0.1.0-extra" | jq -r '.layers[].size'
crane export "$REG/lab/notes-api:0.1.0-extra" - | tar -t
crane export "$REG/lab/notes-api:0.1.0-extra" - | tar -xO etc/notes/README
crane validate --remote "$REG/lab/notes-api:0.1.0-extra"

Expected:

registry.ct.lab:5000/lab/notes-api@sha256:097bb022375621579f98a39b4e4687566e249aeb7853…
105673
4535388
204
etc
etc/notes
etc/notes/README
notes-api
etc/ssl
etc/ssl/certs
etc/ssl/certs/ca-certificates.crt
gebaut ohne Build: Tag 7
PASS: registry.ct.lab:5000/lab/notes-api:0.1.0-extra

export delivers the assembled filesystem as one tar – handy for looking into a scratch image that has no shell. --owner=0 ensures that the file in the image belongs to root and not to your UID 1000. crane blob fetches individual blobs, and crane auth get shows what crane finds for a registry:

L=$(crane manifest "$REG/lab/notes-api:0.1.0-extra" | jq -r '.layers[-1].digest')
crane blob "$REG/lab/notes-api@$L" | tar -tz
echo "$REG" | crane auth get; echo

Expected:

etc/
etc/notes/
etc/notes/README
{"Username":"lab","Secret":"lab-registry-pw-123"}

Clean up the playground – deleting by digest takes all tags with it:

for t in 0.1.0 0.1.0-mut 0.1.0-extra; do
  crane delete "$REG/lab/notes-api@$(crane digest "$REG/lab/notes-api:$t")"
done
crane ls "$REG/lab/notes-api"; echo "(leer)"
rm -rf api.tar api-oci extra extra.tar

Expected:

(leer)

Save your progress? Sign up for free

Checkpoint

The registry responds with TLS and login:

cd ~/ct-lab/tag07
source ~/ct-lab/setup/env.sh
curl -s -o /dev/null -w '%{http_code}\n' -u "$REG_USER:$REG_PASS" "https://$REG/v2/"

Expected:

200

Podman and crane & co. are logged in:

jq -r '.auths | keys[]' "$XDG_RUNTIME_DIR/containers/auth.json"
jq -r '.auths | keys[]' ~/.docker/config.json

Expected:

registry.ct.lab:5000
registry.ct.lab:5000

The three notes images and nginx with the original digest:

crane catalog "$REG"
crane digest "$REG/library/nginx:1.30.6-alpine"

Expected:

lab/notes-api
library/nginx
notes/notes-api
notes/notes-web
notes/notes-worker
sha256:0e52bd054126cdc040b1276c0af347aeb02a41b9cfe305d6094767ac30e97949

The playground lab/notes-api is empty:

crane ls "$REG/lab/notes-api" | wc -l

Expected:

0

Challenge

How many bytes does an arm64 machine download when it pulls nginx:1.30.6-alpine? Answer the question from your registry, without pulling an image.

Hint: The layer sizes in the manifest are the compressed sizes – exactly what goes over the wire.

Solution

crane manifest --platform linux/arm64 "$REG/library/nginx:1.30.6-alpine" \
  | jq '[.layers[].size] | add'
crane manifest --platform linux/arm64 "$REG/library/nginx:1.30.6-alpine" \
  | jq '.config.size'

Expected:

25955460
12310

Around 26 MB of layers plus a config of a little over 12 kB. Unpacked, the image is larger (podman images shows the unpacked size).

Save your progress? Sign up for free

Enterprise Note

  • Instead of your own CA: a certificate from the corporate PKI or ACME; distributing the CA to all clients (system store, build runners, Kubernetes nodes) is the real work.
  • htpasswd is enough for the lab. In production: Harbor, Zot, GitLab, Artifactory or a cloud registry service with SSO, robot accounts per pipeline and permissions per repository.
  • Never keep logins unencrypted in ~/.docker/config.json on shared machines: use credential helpers (pass, secretservice) or short-lived tokens from CI.
  • In production, deletion is usually a retention policy of the registry (e.g. “keep the last 10 tags”) plus regular garbage collection in the maintenance window.
  • crane mutate/append modify signed images – the signature no longer applies afterwards (new digest). Such steps belong before signing (Day 14).