pants: docker backend doesn't use buildx for multi-platform

Describe the bug Docker backend runs docker build rather than docker buildx build for multi-platform builds specified with build_platform set to a list. Single valued lists for build_platform will build correctly, but fail to produce a multi-architecture output image.

Pants version 2.18.0a0 (verified bug still present on mainline, source linked below)

OS MacOS

Additional info Docker version 24.0.6, build ed223bc

Using docker build vs docker buildx build: https://github.com/pantsbuild/pants/blob/78111bbc105418dc2f419181e67c8ec2f80f439a/src/python/pants/backend/docker/util_rules/docker_binary.py#L67

Experimenting with docker build directly:

$ docker build --platform=linux/amd64,linux/arm64 .
[+] Building 0.0s (0/0)                                                                                                  docker:desktop-linux
ERROR: Multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@rajeshwar-nu Yes, this is coming in 2.19 as part of https://github.com/pantsbuild/pants/pull/20154 as mentiond above