docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.1k stars 525 forks source link

Buildx Error with multiple platforms: Not supporting manifest list #1157

Closed Freezor closed 6 days ago

Freezor commented 6 days ago

Contributing guidelines

I've found a bug, and:

Description

I am encountering an issue with Docker Buildx when attempting to build and test Docker images for multiple platforms (linux/amd64 and linux/arm64) using GitHub Actions. The error message received is:

Error: buildx failed with: ERROR: docker exporter does not currently support exporting manifest lists

When I test it with single platforms in multiple steps, that works, but I should also work in a single step.

Expected behaviour

I expect the GitHub Actions workflow to successfully build Docker images for both linux/amd64 and linux/arm64 platforms using Docker Buildx.

Actual behaviour

Currently, when executing the GitHub Actions workflow, Docker Buildx fails with the following error:

ERROR: docker exporter does not currently support exporting manifest lists

As a result, Docker images are not successfully built for the specified platforms (linux/amd64 and linux/arm64).

Repository URL

https://github.com/eclipse-aaspe/server

Workflow run URL

https://github.com/eclipse-aaspe/server/actions/runs/9677083504/job/26697984290?pr=308

YAML workflow

name: 'Test and verify branch'

on:
  pull_request:
    branches:
      - main
      - release
    types: [ opened, synchronize, reopened, edited ]
  push:
    branches:
      - main
      - release

jobs:
  run-unit-tests:
    runs-on: ubuntu-latest
    name: Run all project unit tests
    permissions:
      contents: write
      pull-requests: write
      actions: read
      checks: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.0.x'

      - name: Build
        run: dotnet build --configuration Release
        working-directory: src

      - name: Test
        run: dotnet test --logger "trx;LogFileName=test-results.trx" || true
        working-directory: src

      - name: upload test report
        uses: actions/upload-artifact@v4
        with:
          name: test-results
          path: "**/test-results.trx"

  test-docker-images:
    runs-on: ubuntu-latest
    name: Build all docker images
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          platforms: linux/amd64,linux/arm64,linux/arm32

      - name: Build AasxServerBlazor
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/arm64, linux/amd64
          file: ./src/docker/Dockerfile-AasxServerBlazor
          tags: adminshellio/aasx-server-blazor:test

      - name: Build AasxServerBlazor AMD
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/amd64
          file: ./src/docker/Dockerfile-AasxServerBlazor
          tags: adminshellio/aasx-server-blazor-amd:test

      - name: Build AasxServerBlazor-arm32
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/arm/v7
          file: ./src/docker/Dockerfile-AasxServerBlazor
          tags: adminshellio/aasx-server-blazor-arm32:test

      - name: Build AasxServerBlazor-arm64
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/arm64
          file: ./src/docker/Dockerfile-AasxServerBlazor
          tags: adminshellio/aasx-server-blazor-arm64:test

      - name: Build AasxServerCore
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/amd64,linux/arm64
          file: ./src/docker/Dockerfile-AasxServerAspNetCore
          tags: adminshellio/aasx-server-core:test

      - name: Build AasxServerCore-arm32
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/arm/v7
          file: ./src/docker/Dockerfile-AasxServerAspNetCore
          tags: adminshellio/aasx-server-core-arm32:test

      - name: Build AasxServerCore-arm64
        uses: docker/build-push-action@v6
        with:
          push: false
          load: true
          platforms: linux/arm64
          file: ./src/docker/Dockerfile-AasxServerAspNetCore
          tags: adminshellio/aasx-server-core-arm64:test

  check-release:
    runs-on: windows-latest
    name: Check that the whole project is buildable and attach packages to process
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set execution policy
        run: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
        shell: pwsh

      - name: Set timestamp
        id: set_timestamp
        run: |
          $current_time = $(date +'%Y-%m-%d-T-%H-%M-%S')
          echo "timestamp=$current_time" >> $env:GITHUB_OUTPUT
          Write-Host "The current timestamp is: $current_time"

      - name: Extract branch name
        id: extract_branch
        run: |
          git fetch --all
          $commitSHA = git rev-parse HEAD
          $branch = git branch -r --contains $commitSHA | Select-String -Pattern 'origin/' | Select-Object -First 1 | ForEach-Object { $_.Line -replace '.*origin/', '' } | ForEach-Object { $_.Trim() }
          echo "branch=$branch" >> $env:GITHUB_OUTPUT
          Write-Host "The current branch is: $branch"
        shell: pwsh

      - name: Generate Version Number
        working-directory: src
        id: generate_version_number
        run: |
          $branch = '${{ steps.extract_branch.outputs.branch }}'
          $version = .\BuildVersionNumber.ps1 -suffix alpha -branch $branch -githubRunNumber ${{ github.run_number }}
          echo "version=$version" >> $env:GITHUB_OUTPUT
          Write-Host "The version name to build is: $version"
        shell: pwsh

      - name: Update version numbers in project
        working-directory: src
        run: |
          $version = '${{ steps.generate_version_number.outputs.version }}'
          Write-Host "Updating project versions to: $version"
          .\UpdateProjectVersions.ps1 -version $version
        shell: pwsh

      - name: Setup .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.0.x'

      - name: Build release
        working-directory: src
        run: .\BuildForRelease.ps1
        shell: pwsh

      - name: Package release
        working-directory: src
        run: |
          $version = '${{ steps.generate_version_number.outputs.version }}'
          mkdir -p artefacts/release/$version
          Write-Host "Packaging for the release version: $version"
          .\PackageRelease.ps1 -version $version
        shell: pwsh

      - name: Upload AasxServerBlazor
        uses: actions/upload-artifact@v4
        with:
          name: AasxServerBlazor.LATEST.${{ steps.generate_version_number.outputs.version }}.${{ steps.set_timestamp.outputs.timestamp }}
          path: artefacts/release/${{ steps.generate_version_number.outputs.version }}/AasxServerBlazor.zip
          if-no-files-found: error

      - name: Upload AasxServerAspNetCore
        uses: actions/upload-artifact@v4
        with:
          name: AasxServerAspNetCore.LATEST.${{ steps.generate_version_number.outputs.version }}.${{ steps.set_timestamp.outputs.timestamp }}
          path: artefacts/release/${{ steps.generate_version_number.outputs.version }}/AasxServerAspNetCore.zip
          if-no-files-found: error

Workflow logs

logs_25329296674.zip

BuildKit logs

No response

Additional info

No response

crazy-max commented 6 days ago

When using load: true it will export to the docker store which does not support multi-platform images by default atm. Looking at your workflow I guess you just want to test building your images without exporting anything so I think you should use the type=cacheonly exporter: https://docs.docker.com/build/exporters/#cache-only-export

      - name: Build AasxServerBlazor
        uses: docker/build-push-action@v6
        with:
          outputs: type=cacheonly
          platforms: linux/arm64, linux/amd64
          file: ./src/docker/Dockerfile-AasxServerBlazor
          tags: adminshellio/aasx-server-blazor:test
Freezor commented 6 days ago

Hi @crazy-max . thanks for the fast reply. that was this. Thanks