uber / kraken

P2P Docker registry capable of distributing TBs of data in seconds
Apache License 2.0
6.11k stars 416 forks source link

Support Multi-Arch by Supporting Manifest List #326

Closed xinlongz1 closed 2 years ago

xinlongz1 commented 2 years ago

Summary: Adds Multi-Arch support by supporting manifest list.

Testing Bring up dev cluster locally.

  1. Build two images with different arch.
    REPOSITORY              TAG           IMAGE ID       CREATED      SIZE
    testing/testing-build   arm64v8-1.0   cb18cbc8100d   6 days ago   74.5MB
    testing/testing-build   amd64-1.0     840a89ece7a1   6 days ago   80.9MB
  2. Push them.
    xinlongz@xinlongz-C02ZX4VAMD6M multi-arch % docker push localhost:15000/testing/testing-build:arm64v8-1.0
    The push refers to repository [localhost:15000/testing/testing-build]
    948260395c24: Pushed 
    377e88cd1334: Pushed 
    arm64v8-1.0: digest: sha256:0e19e811ecf370db27644346585b89152af8c647addf9e1b302e0864f0e07b93 size: 740
    xinlongz@xinlongz-C02ZX4VAMD6M multi-arch % docker push localhost:15000/testing/testing-build:amd64-1.0
    The push refers to repository [localhost:15000/testing/testing-build]
    ebbade774b0d: Pushed 
    56a5c11640c8: Pushed 
    amd64-1.0: digest: sha256:d35e2f18bd6f155884c9f91ff85120480e9aed203b7285911c922d6f900c5a15 size: 740
  3. Create the manifest list.
    docker manifest create --insecure localhost:15000/testing/testing-build:1.0 localhost:15000/testing/testing-build:arm64v8-1.0 localhost:15000/testing/testing-build:amd64-1.0
    Created manifest list localhost:15000/testing/testing-build:1.0
  4. Push the manifest list.
    docker manifest push --insecure localhost:15000/testing/testing-build:1.0
    sha256:6f4eb514d2427f874bc2176111a794a1fcaf49bbdd2d87ac95075799b5bf281b
  5. docker pull with the manifest list tag.
    docker pull localhost:16000/testing/testing-build:1.0
    1.0: Pulling from testing/testing-build
    Digest: sha256:6f4eb514d2427f874bc2176111a794a1fcaf49bbdd2d87ac95075799b5bf281b
    Status: Downloaded newer image for localhost:16000/testing/testing-build:1.0
    localhost:16000/testing/testing-build:1.0
  6. The pulled image localhost:16000/testing/testing-build:1.0 has the same image ID as the images with amd64-1.0 tag. This is because the platform of the local machine is amd64.
    testing/testing-build                            arm64v8-1.0   cb18cbc8100d   6 days ago      74.5MB
    localhost:15000/testing/testing-build            arm64v8-1.0   cb18cbc8100d   6 days ago      74.5MB
    testing/testing-build                            amd64-1.0     840a89ece7a1   6 days ago      80.9MB
    localhost:15000/testing/testing-build            amd64-1.0     840a89ece7a1   6 days ago      80.9MB
    localhost:16000/testing/testing-build            1.0           840a89ece7a1   6 days ago      80.9MB
CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.