Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
colin-grapl opened this issue Jun 9, 2021 · 3 comments · Fixed by #669
Closed

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

colin-grapl opened this issue Jun 9, 2021 · 3 comments · Fixed by #669

Comments

@colin-grapl
Copy link

colin-grapl commented Jun 9, 2021

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

@tonistiigi
Copy link
Member

I think this is some new compose option that isn't actually 3.8 . Versions up to 3.9 should be supported https://github.com/docker/buildx/blob/master/vendor/github.com/docker/cli/cli/compose/schema/bindata.go#L647

@chris-crone
Copy link
Member

Hi @colin-grapl, I believe this is because of changes we've made to the Compose spec without updating the parser in buildx. I've created a ticket to track using the compose-spec/compose-go parser: #634

@colin-grapl
Copy link
Author

Agreed @chris-crone , thanks for tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants