I recently found that a Docker image I use as a part of one of my Helm charts was no longer available on DockerHub, and I hadn't mirrored it in another location. It was running in a K3s cluster, meaning I couldn't
docker tag original-maintainer/image:tag me/image:tag it and push to the Hub myself back on my local machine, which was running the Docker CLI.
First, logging into a node with the image on it, I ran the following:
ctr -n k8s.io images export bind9:9.11.tar docker.io/internetsystemsconsortium/bind9:9.11 --platform linux/amd64
which exported the image to a tarball. This is similar to
docker image save.
Then, pulling it down to my Docker CLI machines:
scp email@example.com:bind9:9.11.tar .
load the image from the tarball:
docker image load --input bind9\:9.11.tar
which returns the original tag for the image (
internetsystemsconsortium/bind9:9.11) so I can re-tag it and push:
docker image tag internetsystemsconsortium/bind9:9.11 jmarhee/bind9:9.11 docker push jmarhee/bind9:9.11
Now this image is available on Docker Hub for my (and your) new clusters to access.