Bitácora

Zot rechazaba mis imágenes: Docker v2 contra OCI

· Mariano Rac

Zot es un registro de imágenes ligero que solo habla el estándar OCI. Lo usé en dos proyectos del laboratorio de Sistemas Operativos 1, y en los dos me devolvió el mismo error al subir imágenes: 415 Unsupported Media Type, o su versión manifest invalid.

Primera vez: containerd en una VM

En el proyecto de las tres máquinas virtuales, la VM de containerd construía su imagen con nerdctl build. Podman y Docker subían sin problemas, pero desde containerd el push fallaba con 415. La razón: nerdctl build genera el manifiesto en formato Docker v2, y Zot solo acepta manifiestos OCI. La imagen es la misma; lo que cambia es el media type del documento que la describe.

sudo nerdctl image convert --oci api1-202101149:latest api1-202101149:oci
sudo nerdctl tag api1-202101149:oci 192.168.122.76:5000/api1-202101149:latest
sudo nerdctl push 192.168.122.76:5000/api1-202101149:latest

Segunda vez: docker push en Google Cloud

En el proyecto de Kubernetes, Zot corría en una VM de Compute Engine con HTTPS. Al copiar imágenes de terceros con docker push volvió el manifest invalid: Docker sube el manifiesto en formato Docker v2. Esta vez la solución fue skopeo, que convierte el manifiesto al copiar:

skopeo copy --override-os linux --override-arch amd64 --format oci \
  "docker://$src" "docker://$ZOT_DOMAIN/$dst"

Y un tercer detalle

Copiar Grafana seguía fallando con stream error, aun en formato OCI. El log de Zot mostraba i/o timeout: el registro corta cada petición a los 60 segundos, y una capa de 194 MB en un solo PUT no alcanzaba a subir desde la conexión de mi casa. El script final hace la copia dentro de la propia VM de Zot: la descarga va por la red de Google y la subida es local. Tardó 28 segundos.

Lo que me llevo

"Imagen de contenedor" no es un solo formato. Cuando un registro estricto rechaza algo que otro acepta, lo primero es revisar el media type del manifiesto, y para copiar entre registros, skopeo (y oras para artifacts que no son imágenes) evita pasar todo por Docker.

Notes

Zot kept rejecting my images: Docker v2 vs. OCI

· Mariano Rac

Zot is a lightweight image registry that only speaks the OCI standard. I used it in two projects for the Operating Systems 1 lab, and both times it answered the same error when I pushed images: 415 Unsupported Media Type, or its manifest invalid variant.

First time: containerd on a VM

In the three-VM project, the containerd VM built its image with nerdctl build. Podman and Docker pushed fine, but from containerd the push failed with 415. The reason: nerdctl build writes the manifest in Docker v2 format, and Zot only accepts OCI manifests. The image is the same; what changes is the media type of the document that describes it.

sudo nerdctl image convert --oci api1-202101149:latest api1-202101149:oci
sudo nerdctl tag api1-202101149:oci 192.168.122.76:5000/api1-202101149:latest
sudo nerdctl push 192.168.122.76:5000/api1-202101149:latest

Second time: docker push on Google Cloud

In the Kubernetes project, Zot ran on a Compute Engine VM with HTTPS. Copying third-party images with docker push brought back manifest invalid: Docker pushes the manifest in Docker v2 format. This time the fix was skopeo, which converts the manifest while copying:

skopeo copy --override-os linux --override-arch amd64 --format oci \
  "docker://$src" "docker://$ZOT_DOMAIN/$dst"

And a third detail

Copying Grafana kept failing with stream error, even in OCI format. Zot's log showed i/o timeout: the registry cuts every request at 60 seconds, and a 194 MB layer in a single PUT couldn't finish uploading from my home connection. The final script runs the copy inside the Zot VM itself: the download goes over Google's network and the upload is local. It took 28 seconds.

What I take from it

"Container image" isn't a single format. When a strict registry rejects something another one accepts, the first thing to check is the manifest's media type, and for copying between registries, skopeo (and oras for artifacts that aren't images) avoids routing everything through Docker.