GitHub Package Registry does not support multi-CPU architecture image

We can use " docker buildx" to multi-architecture images. However, if I try to push to GitHub Package Registry, it returns “406 Not Acceptable”. However, the same image is able to push to DockerHub.

Hi @joshuaavalon,

This error can be surfaced if you are trying to interact with the package registry without authenticating. Unfortunately we don’t currently support anonymous access to the package registry, regardless of if the package is private or public.

Can you please follow the authentication steps listed here: https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry#authenticating-to-github-package-registry

I have logged in. You can take a look at https://github.com/joshuaavalon/docker-cloudflare/commit/044730ae29ade684062357f0cf92da7b1de69f8b/checks?check_suite_id=239542361

Also, I believe if you are not logged in, you get 401 Unauthorized instead of 406 Not Acceptable.

Using docker manifest create with Github packages for multi-arch containers doesn’t seem to work.

I’ve created a simple test https://github.com/bfjelds/test-packages-as-container-repo to validate that I can:

  • build amd64, arm32, and arm64 containers
  • create and push a single manifest for all of the platforms

This works with ACR and Dockerhub, but fails when I call:

> DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0 docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0-amd64

This is the error generated:

no such manifest: docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0-amd64

The container referenced can be pulled, so it stands to reason that it exists:

> docker pull docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0-amd64
v0.1.0-amd64: Pulling from bfjelds/test-packages-as-container-repo/test
Digest: sha256:8c6927676cde46c2ddd40c34f29d504f7dde3701f5e09e3723057bd25bfc87c7
Status: Image is up to date for docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0-amd64
docker.pkg.github.com/bfjelds/test-packages-as-container-repo/test:v0.1.0-amd64

Hi @bfjelds,

Using docker manifest create with Github packages for multi-arch containers doesn’t seem to work.

I’m afraid this is correct, multi-arch images aren’t currently supported. The team are however working on a new implementation of the GitHub container registry. I believe this is something that should be supported!

I’m sorry I can’t offer you a workaround for this. It is something I’ve wanted to support on my own projects and I haven’t found a way to make it work.

Regards,
Jamie.

Does the new Github Container Registry (https://github.blog/2020-09-01-introducing-github-container-registry/) support multi-arch containers?

it looks like not yet: Handle multi-arch Docker images on GitHub Package Registry

works as of today :slight_smile:

We rolled out a fix for GHCR this week :tada:

The UI hasn’t been updated yet so you won’t see indications of multi-arch images when looking at the container pages. The UI fixes should come soon.

For now though the container registry supports storing and retrieving these. Here’s an example Actions workflow I’m using to build multi-architecture images. You can also use the run command line version as well.

name: Docker Container Build Workflow

on:
  schedule:
    - cron: '0 10 * * *' # everyday at 10am
  push:
    branches: 
      - main
    tags:
      - 'v*.*.*'
  pull_request:
    branches: 
      - main

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2

      - name: Prepare
        id: prep
        run: |
          DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/test/multi-arch
          VERSION=edge
          if [[ $GITHUB_REF == refs/tags/* ]]; then
            VERSION=${GITHUB_REF#refs/tags/v}
          fi
          if [ "${{ github.event_name }}" = "schedule" ]; then
            VERSION=nightly
          fi
          TAGS="${DOCKER_IMAGE}:${VERSION}"
          if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
            TAGS="$TAGS,${DOCKER_IMAGE}:latest"
          fi
          echo ::set-output name=tags::${TAGS}

          # lowercase the branch name
          BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
          LABELS="org.opencontainers.image.revision=$GITHUB_SHA"
          LABELS="$LABELS,org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
          LABELS="$LABELS,org.opencontainers.image.version=$VERSION"
          LABELS="$LABELS,com.github.repo.branch=$BRANCH"
          LABELS="$LABELS,com.github.repo.dockerfile=Dockerfile"
          echo ::set-output name=labels::${LABELS}

          BUILD_ARGS="BRANCH=$BRANCH"
          echo ::set-output name=args::${BUILD_ARGS}

      - name: Tag names
        run: echo ${{ steps.prep.outputs.tags }}

      - name: Set up QEMU
        uses: docker/setup-qemu-action@master
        with:
          platforms: all

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@master

      - name: Builder instance name
        run: echo ${{ steps.buildx.outputs.name }}

      - name: Available platforms
        run: echo ${{ steps.buildx.outputs.platforms }}

      - name: Login to GHCR
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v1 
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GHCR_PAT }}

      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2-working-branch
        with:
          builder: ${{ steps.buildx.outputs.name }}
          context: .
          file: ./Dockerfile
          platforms: linux/amd64,linux/arm64,linux/386
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.prep.outputs.tags }}
          build-args: ${{ steps.prep.outputs.args }}
          labels: ${{ steps.prep.outputs.labels }}
2 Likes

It seems this still doesn’t work correctly with GHCR

I can create a manifest perfectly fine

DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "ghcr.io/rmb938/hostport-allocator:master" ghcr.io/rmb938/hostport-allocator-linux-amd64:master ghcr.io/rmb938/hostport-allocator-linux-armv7:master ghcr.io/rmb938/hostport-allocator-linux-arm64:master

Created manifest list ghcr.io/rmb938/hostport-allocator:master

But when I try and push it I get this error

DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "ghcr.io/rmb938/hostport-allocator:master"

error mounting rmb938/hostport-allocator-linux-amd64@sha256:671e079b22e48fb6979dbf91a8c2810b4b4dc0f0f16cf2a9379f22df0fb45346 to ghcr.io/rmb938/hostport-allocator:master