2

I am looking to mirror Docker images to a Harbor instance based on tags and digests.

My standard approach thus far has involved creating Harbor Replication Rules. This works well for replicating Docker images with specific tags, however I cannot find a way to replicate based on an image digest (e.g. ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3).

I understand that adding a Replication Rule based on a digest means that the image should only be pulled once, so this is probably a bit of an odd use-case for Replications (which aim to pull down updated images over time).

My alternative solution would be to pull the image (docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3) and then push it to Harbor directly if this isn't possible.

I have tried the following Replication Rules, none of which replicate the desired image:

  • 'Tag' 'matching' 'sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3'
  • 'Tag' 'matching' '@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3'
  • 'Tag' 'matching' '20.04@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3'

I have also tried 'Tag' 'matching' '20.04' and this succeeded, but did not have the correct digest.

Thomas Anderson
  • 424
  • 4
  • 5
  • For those following along, I ended up running a script on a timer to run `crane copy` to copy the images from the remote repository into Harbor, which also maintained the image digest. https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane_copy.md – Thomas Anderson Nov 18 '22 at 05:47

0 Answers0