Challenge,ย Medium, ย onย  Containers Submissions: 27/47

The easiest way to copy an image from one repository to another is to use Docker, Podman, or a similar "high-level" container runtime to pull, re-tag, and push the image to its new home. However, this approach has a few significant drawbacks:

  • A fully-featured container runtime has to be installed on the host to perform a relatively simple task.
  • A full copy of the image has to be stored locally before it can be pushed to a different registry (which may be problematic for large images).
  • Unnecessary high permissions may be involved; for instance, the Docker daemon runs as root, but you don't have to be a root to move images around.

Luckily, there are more lightweight and efficient ways to copy an image from one repository to another, and in this challenge, you will need to use one of them.

Your task is to copy a public ghcr.io/iximiuz/labs/nginx image from GHCR to the playground's private repository without using Docker, Podman, or any other container runtime. To complete the challenge, store the ghcr.io/iximiuz/labs/nginx image in its new home registry.iximiuz.com/third-party/nginx. You need to copy only one tag - :alpine.

Beware that registry.iximiuz.com is protected by basic authentication with the username iximiuzlabs and password rules!.

Good luck!

Hint 1 ๐Ÿ’ก

At the end of the day, an image is just a collection of blobs and JSON files sent over a well-defined HTTP API. If you're a true hacker, you can use curl or wget and follow the OCI Distribution Spec to copy an image layer by layer.

Hint 2 ๐Ÿ’ก

For the rest of us, there are tools like crane, skopeo, and regctl that, in particular, can come in handy when copying images from one repository to another.

Hint 3 ๐Ÿ’ก

Pro tip: arkade is a great tool to install other CLI tools on your system. Every playground comes with arkade pre-installed, so you can get regctl or crane with a simple:

arkade get regctl crane
Hint 4 ๐Ÿ’ก

Do not forget to authenticate with the private registry before pushing the image! All of the tools mentioned in the previous hints have a pretty straightforward way to do that.

Hint 5 ๐Ÿ’ก

Getting the unsupported MIME type for compression: application/vnd.in-toto+json error while using skopeo? Make sure to install the latest version of skopeo - older versions lack support for OCI artifacts (non-image blobs), and the image tag you need to copy contains not only builds for different platforms but also some blobs with provenance information.

Level up your Server Side game โ€” Join 7,800 engineers who receive insightful learning materials straight to their inbox