• About Me
  • Impressum
  • Privacy
  • Status Page

№42

... it's better to have good questions

Mirroring a container registry

August 16, 2024 2 min read Container How-To Ronny Trommer

I was working on an article How to run an air gap installation of OpenNMS Horizon on Rocky Linux. I ran into a similar use case and it was not about RPMs or DEB packages, it was all about container images and registries. My question was, how can I get “all” container images into a private registry from DockerHub? Getting your hands dirty with a private registry is something I’ve described in Running a private container registry for testing. Here is a short how-to on how I did it for my future self or anyone else with a similar question.

You can get container images very easily using the tool skopeo. It can be easily installed using apt, dnf, or brew. Once the tool is installed, you can use it like this to copy an image from one registry to another, using here an example with DockerHub and Quay.io. You have to do a skopeo login to Quay.io to be able to push images. Instead of Quay.io you can use your internal installed registry. The argument --all fetches all architecture images for a given tag.

skopeo copy --all docker://opennms/horizon:33.0.7 docker://quay.io/labmonkeys/onms-horizon:33.0.7

What you will notice, skopeo wants the docker tag. What if you have lots of tags you want to copy? DockerHub has an API that allows you to fetch the tags for a given repository. Unfortunately, it has paging you can’t get all tags at once. A little bash script around curl can help you with that. If you have a lot of tags and images you want to move, you probably need to log in to DockerHub as well, because you can exceed the pull limits as an anonymous user very quickly.

#!/bin/bash

REPO="${1}" # something like opennms/horizon
# Initial URL for the first page of tags
url="https://hub.docker.com/v2/repositories/${REPO}/tags?page_size=100"

# Loop through pages
while [ "$url" != "null" ]; do
  # Fetch the current page
  response=$(curl --silent "$url")

  # Extract and print tag names
  echo "$response" | jq -r '.results[].name'
  # Get the next page URL
  url=$(echo "$response" | jq -r '.next')
done

Son long and happy image copying

Image by srkcalifano from Pixabay

Container Registry
Latest posts
  • How Docker Broke the Internet for Me
  • macOS with Apple Silicon and x86-64-v3 support
  • Streaming telemetry with gNMI
  • Go away or I replace you with a Makefile
  • SNMP Proxy ... wait what?
  • Hackathon on BGP monitoring using BMP in OpenNMS
  • Dealing with secrets in OpenNMS Horizon
  • Building container images for OpenNMS
  • Hello Containerlab with Orbstack
  • OpenNMS Horizon with RRDtool
Categories
  • OpenNMS (27)
  • Technology (26)
  • How-To (22)
  • Monitoring (13)
  • Container (8)
  • Tutorial (8)
  • Events (6)
  • Open-Source (6)
  • BGP (2)
  • Networking (2)
Social media
© 2025 made in 🇪🇺 by Ronny Trommer with ❤️ for Open Source
Bilberry Hugo Theme