Skip to content

Instantly share code, notes, and snippets.

@ndeloof
Created September 20, 2019 12:10
Show Gist options
  • Select an option

  • Save ndeloof/da29ccdbb6e427b1613944518fd0df0f to your computer and use it in GitHub Desktop.

Select an option

Save ndeloof/da29ccdbb6e427b1613944518fd0df0f to your computer and use it in GitHub Desktop.

Revisions

  1. ndeloof created this gist Sep 20, 2019.
    36 changes: 36 additions & 0 deletions multiarch.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    #! /bin/bash

    # Compatibility check for registry to support multi-architecutre docker images
    # (also required for docker app support)
    #
    # Usage:
    # docker login <REGISTRY>
    # ...
    # ./multiarch.sh <REGISTRY>
    #


    set -x
    set -e

    REGISTRY=$1


    # Pull busybox archtecture specific images used within this script
    docker pull busybox@sha256:dd97a3fe6d721c5cf03abac0f50e2848dc583f7c4e41bf39102ceb42edfd1808
    docker pull busybox@sha256:b6e25123419cbaa5f07cf8e1a8b2e813cc6e7939b6c0d38161c7cfa435dbdc8d

    # Tag images for target registry and push
    docker tag busybox@sha256:b6e25123419cbaa5f07cf8e1a8b2e813cc6e7939b6c0d38161c7cfa435dbdc8d $REGISTRY/busybox:arm8
    docker tag busybox@sha256:dd97a3fe6d721c5cf03abac0f50e2848dc583f7c4e41bf39102ceb42edfd1808 $REGISTRY/busybox:amd64
    docker push $REGISTRY/busybox:arm8
    docker push $REGISTRY/busybox:amd64

    # manifest CLI command is experimental
    export DOCKER_CLI_EXPERIMENTAL=enabled

    # Create multi-arch manifest
    docker manifest create $REGISTRY/busybox $REGISTRY/busybox:amd64 $REGISTRY/busybox:arm8

    # Push multi-arch manifest
    docker manifest push $REGISTRY/busybox