How to maintain a local repository of docker images in case they go offline?
from ComradeMiao@lemmy.world to selfhosted@lemmy.world on 10 Nov 2024 21:34
https://lemmy.world/post/21875407

Thanks for all the great replies!

#selfhosted

threaded - newest

just_another_person@lemmy.world on 10 Nov 2024 21:39 next collapse

Retag and push to a local registry. Lots of options out there for setting one up.

Honestly, you already have the image locally if you’ve pulled it. You don’t really need to run a registry unless you’re dead set on it. You can also flatten and export containers for backup if you really want.

thirdBreakfast@lemmy.world on 10 Nov 2024 22:08 next collapse

Two good points here OP. Type docker image ls to see all the images you currently have locally - you’ll possibly be surprised how many. All the ones tagged <none> are old versions.

If you’re already using github, it includes an package repository you could push retagged images to, or for more self-hosty, a local instance of Forgejo would be a good option.

foster@lemmy.fosterhangdaan.com on 10 Nov 2024 23:20 collapse

I’d also like to add that you can save an image to a local file using docker image save and load them back using docker image load. So, along with the options mentioned above, you have plenty of options to backup images for offline use.

rikudou@lemmings.world on 10 Nov 2024 23:56 collapse

Honestly, you already have the image locally if you’ve pulled it.

I guess not everyone treats their PC as an ephemeral storage, huh? I don’t trust anything that’s available only locally to survive.

just_another_person@lemmy.world on 11 Nov 2024 00:02 next collapse

Well the question is about a container disappearing from a public registry, in which case nothing would happen if it’s already pulled locally. Figuring where to go from there is the other half of that problem.

GBU_28@lemm.ee on 11 Nov 2024 01:22 collapse

Then backup whatever you set your docker local storage to?

Lem453@lemmy.ca on 10 Nov 2024 21:40 next collapse

The vast majority of selfhosters probably don’t but if you want its called a private repository

digitalocean.com/…/how-to-set-up-a-private-docker…

Deckweiss@lemmy.world on 10 Nov 2024 22:09 next collapse

Sorry for the link dump - I just glanced over the content and it seems like this might help you:

www.warpbuild.com/blog/docker-mirror-setup

medium.com/…/deploying-a-docker-registry-mirror-a…

blog.alexellis.io/how-to-configure-multiple-docke…

stackoverflow.com/a/41593925

timbuck2themoon@sh.itjust.works on 11 Nov 2024 00:13 next collapse

Just use a sonatype nexus 3 image and proxy docker hub, etc. Then you pull images through it.

precarious_primes@lemmy.ml on 11 Nov 2024 16:24 collapse

We run this at work so we have forever copies of image tags and to reduce dockerhub rate limit issues. Works well even for a large dev team.

undefined@lemmy.hogru.ch on 11 Nov 2024 00:17 next collapse

Isn’t a Docker registry just HTTP? Would a caching proxy be too hard to use for this?

scrubbles@poptalk.scrubbles.tech on 11 Nov 2024 05:34 next collapse

For most of you suggesting hosting a repository - yes but,

Host forgejo. Just host the git mirror. It comes with a package repo out of the box. Then you have the source code and the docker images

DieserTypMatthias@lemmy.ml on 12 Nov 2024 09:21 next collapse

Host forgejo.

Or Gitea if you want to run the upstream.

rearview@lemmy.zip on 12 Nov 2024 18:42 collapse

An alternative method is to run an actions workflow that syncs from upstream images directly, like what Forgejo actually do.

code.forgejo.org/forgejo/oci-mirror

scrubbles@poptalk.scrubbles.tech on 12 Nov 2024 18:55 collapse

oh freaking awesome, this looks amazing! Thank you so much for this!

DasFaultier@sh.itjust.works on 11 Nov 2024 08:57 next collapse

At my job, we run goharbor.io and use its Replications feature to do just that.

ShortN0te@lemmy.ml on 10 Nov 2024 21:37 next collapse

I mean you have the current image cached on the local server when you use it.

hyperreal@lemmy.hyperreal.coffee on 17 Nov 2024 04:34 collapse

I don’t know if this will help you, but I wrote a tutorial on how to setup a local registry on the LAN on a Fedora Server or RHEL-compatible server. …hyperreal.coffee/…/setup-a-lan-container-registr…

But anyway, it’s unlikely docker.io or quay.io or ghcr.io will go completely offline. If anything they might experience a DDoS, in which case I imagine they have competent devops employees who would ensure they become functional again within a matter of hours.

ComradeMiao@lemmy.world on 17 Nov 2024 11:01 collapse

Very interesting thanks!