Skip to content

buildx fails to parse valid docker-compose.yml #629

@colin-grapl

Description

@colin-grapl

The problem: Given a valid docker-compose.yml with a depends_on condition docker buildx bake rejects the file.

docker-compose version 1.29.2, build 5becea4c

Here's a valid docker-compose.example.yml

version: "3.8"

services:
  example-container:
    image: example/fails:latest
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      other-container:
        condition: service_healthy
    networks:
      default:
        aliases:
          - integration-tests

  other-container:
    image: example/other:latest
    healthcheck:
      test: ["CMD", "echo", "success"]
      retries: 5
      interval: 5s
      timeout: 10s
      start_period: 5s
networks:
  default:
    name: test-net

You can repro with:

❯ docker buildx bake --file ./docker-compose.example.yml
[+] Building 0.0s (0/0)                                                                                                                                                               
error: services.example-container.depends_on must be a list

Here's docker-compose:

❯ docker-compose build --file ./docker-compose.example.yml
Build or rebuild services.

Services are built once and then tagged as `project_service`,
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `docker-compose build` to rebuild it.

Note that docker-compose fails but for unrelated reasons - in a 'real' dockerc-compose.yml it does in fact work.

Here's the relevant bit of the compose file spec:
https://github.com/compose-spec/compose-spec/blob/master/spec.md#depends_on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions