Skip to content

Bake does not support platform key in docker-compose.yml #759

@ciaranmcnulty

Description

@ciaranmcnulty

Now that compose-spec is used for bake, this is no longer a syntax error, but the flag doesn't seem to be used when building the images

Dockerfile:

FROM mysql

(note mysql does not provide ARM images)

docker-compose.yml:

services:
  database:
    build:
      context: .
    platform: linux/amd64

On an ARM64 machine (M1 Mac)

% docker-compose build                                           
Building database
[+] Building 0.6s (5/5) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 53B                                                                                                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/mysql:latest                                                                                                                                                                                                                                                    0.6s
 => CACHED [1/1] FROM docker.io/library/mysql@sha256:99e0989e7e3797cfbdb8d51a19d32c8d286dd8862794d01a547651a896bcf00c                                                                                                                                                                                              0.0s
 => exporting to image                                                                                                                                                                                                                                                                                             0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                            0.0s
 => => writing image sha256:9c8cabb8167a46d931af0f0b8646796b55bda249c2a38fcc8284b18a6cd1d4c9                                                                                                                                                                                                                       0.0s
 => => naming to docker.io/library/bake-project-reprod_database  

% docker buildx bake -f docker-compose.yml
[+] Building 0.7s (3/3) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 31B                                                                                                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => ERROR [internal] load metadata for docker.io/library/mysql:latest                                                                                                                                                                                                                                              0.6s
------
 > [internal] load metadata for docker.io/library/mysql:latest:
------
error: failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:99e0989e7e3797cfbdb8d51a19d32c8d286dd8862794d01a547651a896bcf00c: not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions