Description
Description
Using a compose file that has a service which specifies platform:
and also supplying DOCKER_DEFAULT_PLATFORM
will result in an error. The application appears to be requesting two platforms to be targeted despite the fact that an explicit platform should override (not be combine with) a default one.
I believe this is a BUG introduce by #8848, which provided support for DOCKER_DEFAULT_PLATFORM
, but used append
to add it to a list of platforms, instead of letting explicit platforms override the default platform.
NOTE: I do not believe this is an issue with buildkit because I'm unable to reproduce the issue with a direct
docker build
/docker buildx build
command. It's only reproducible when usingdocker compose build
. Hopefully I've created this issue in the right place.
Steps to reproduce the issue:
- Create these required files in a temporary testing directory:
# docker-compose.yml
version: '3.7'
services:
test:
image: test
build:
context: ./
platform: linux/amd64
# Dockerfile
FROM busybox:stable
- Run the following command:
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker compose build test
- You will see the error below.
Describe the results you received:
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")
Describe the results you expected:
compose
should invoke a docker build
command that ignores DOCKER_DEFAULT_PLATFORM
because, as a "default" value, it is expected to be overridden by an explicitly declared platform
.
Output of docker compose version
:
Docker Compose version v2.10.2
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.10.2)
extension: Manages Docker extensions (Docker Inc., v0.2.9)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.19.0)
Server:
Containers: 68
Running: 47
Paused: 0
Stopped: 21
Images: 99
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.10.124-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 19.5GiB
Name: docker-desktop
ID: VIB7:SF2J:RBST:3P2A:JBNY:GFYK:VW6B:MFGG:TPCZ:3UON:U4FW:7THL
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Live Restore Enabled: false
Additional Details:
My use case is that I have multiple services in my compose config file, one of which requires an explicit platform to be used. The others can be built for any target platform. We use, e.g., DOCKER_DEFAULT_PLATFORM=linux/amd64
to specify the desired target platform for services that support it, while the services with explicit platform:
keys are expected to ignore DOCKER_DEFAULT_PLATFORM
.