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

Upgrade to docker 25+ #1124

Closed koleror closed 1 month ago

koleror commented 1 month ago

Description

I'm trying to setup caching following this AWS blog post, but it currently doesn't work as the current docker version seems to be 24.

What I've done:

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

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

    - name: Login to ECR
      uses: docker/login-action@v3
      with:
        registry: <account_id>.dkr.ecr.eu-west-1.amazonaws.com

    - name: Build and push
      uses: docker/build-push-action@v5
      with:
        context: .
        platforms: linux/amd64
        push: true
        tags: <account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:<tag_name>
        outputs: type=docker,dest=/tmp/myimage.tar
        cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=<account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:cache,
        cache-from: type=registry,ref=<account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:cache

Which produces the followigng error in the "Build and push" step:

/usr/bin/docker buildx build --cache-from type=registry,ref=<account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:cache --cache-to mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=<account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:cache, --iidfile /home/runner/work/_temp/docker-actions-toolkit-wyxfSt/iidfile --output type=docker,dest=/tmp/myimage.tar --platform linux/amd64 --tag<account_id>.dkr.ecr.eu-west-1.amazonaws.com/<repo_name>:<tag_name> --metadata-file /home/runner/work/_temp/docker-actions-toolkit-wyxfSt/metadata-file --push .
ERROR: invalid value 
Error: buildx failed with: ERROR: invalid value

From the docker info command executed just before, I found this:

  /usr/bin/docker info
  Client: Docker Engine - Community
   Version:    24.0.9

Any chance the action could be upgraded to 25?

crazy-max commented 1 month ago

I assume you're using ubuntu-latest or ubuntu-22.04 runner image: https://github.com/actions/runner-images?tab=readme-ov-file#available-images

Which currently ships Docker 24.0: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md

We are not maintaining applications installed on GitHub public runners so I suggest to ask on their issue tracker: https://github.com/actions/runner-images/issues or you can switch to ubuntu-24.04 image which has Docker 26.1 installed: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md

koleror commented 1 month ago

Just figured this out! Thanks for answering!