1
0
Fork 0
mirror of https://github.com/imjasonh/kontain.me synced 2026-07-18 23:03:06 +00:00

correctly mirror manifest lists for multi-arch images

This commit is contained in:
Jason Hall 2020-09-18 15:50:29 -04:00
parent db52ef43ab
commit 989ebe612d
4 changed files with 73 additions and 43 deletions

View file

@ -17,7 +17,7 @@ time they are requested.</p>
<p><code>docker pull random.kontain.me/random:latest</code> serves an image containing
random data. By default the image contains one layer containing 10 MB of random
bytes. You can request a specific size and shape of random image. For example,
<code>kontain.me/random:4x100</code> generates a random image of 4 layers of
<code>random.kontain.me/random:4x100</code> generates a random image of 4 layers of
100 random bytes each.
<h1><code>ko.kontain.me</code></h1>

View file

@ -93,13 +93,17 @@ func (s *server) serveMirrorManifest(w http.ResponseWriter, r *http.Request) {
s.info.Printf("INFO (serve.BlobExists(%q)): %v", d, err)
// Blob doesn't exist yet. Try to get the image manifest+layers
// and cache them.
img, err := remote.Image(ref)
idx, err := remote.Index(ref)
if err != nil {
s.error.Printf("ERROR (remote.Image): %v", err)
s.error.Printf("ERROR (remote.Index): %v", err)
serve.Error(w, err)
return
}
if err := serve.Index(w, r, idx); err != nil {
s.error.Printf("ERROR (serve.Index): %v", err)
serve.Error(w, err)
return
}
serve.Manifest(w, r, img)
} else {
serve.Blob(w, r, d.Digest.String())
}