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

Regression in docker-compose: can't set healthcheck.start_interval as feature require Docker Engine 1.25 or later #473

Closed
cjlarose opened this issue Jan 16, 2024 · 4 comments

Comments

@cjlarose
Copy link

cjlarose commented Jan 16, 2024

Recently, the image docker:24.0.7 advanced from sha256:ca9a56ffc0339a72cbf2beb7650f4423258f405520dcc7ac9af4858cfdc09fce to sha256:63897b20cb7da770f94301070dafc902f43cacee189c71c15f6a21e7caeecda1.

The following docker-compose.yaml file worked in the former release and fails in the latter release

services:
  postgres:
    environment:
      POSTGRES_PASSWORD: root
    healthcheck:
      test: ["CMD", "docker-healthcheck"]
      start_period: 30s
      start_interval: 1s
    image: postgres:13

The error message from docker compose up is

can't set healthcheck.start_interval as feature require Docker Engine 1.25 or later

Full command

docker run -it \
  -v /var/run/docker.sock:/run/docker.sock \
  -v "$PWD/docker-compose.yaml":/app/docker-compose.yaml \
  docker@sha256:ca9a56ffc0339a72cbf2beb7650f4423258f405520dcc7ac9af4858cfdc09fce \
  /bin/sh -c 'cd /app && docker compose up'

Returns

[+] Running 1/0
 ✔ Container app-postgres-1  Created                                                                          0.1s 
Attaching to postgres-1
postgres-1  | The files belonging to this database system will be owned by user "postgres".
postgres-1  | This user must also own the server process.
...

New release

docker run -it \
  -v /var/run/docker.sock:/run/docker.sock \
  -v "$PWD/docker-compose.yaml":/app/docker-compose.yaml \
  docker@sha256:63897b20cb7da770f94301070dafc902f43cacee189c71c15f6a21e7caeecda1 \
  /bin/sh -c 'cd /app && docker compose up'

Returns

[+] Running 0/0
 ⠋ Container app-postgres-1  Creating                                                                         0.0s 
can't set healthcheck.start_interval as feature require Docker Engine 1.25 or later

buildx and compose were both upgraded recently docker:24.0.7, so the regression might actually be in one of those projects.

Since I'm bind-mounting my docker socket from the host, docker --version on the host returns

Docker version 24.0.5, build v24.0.5
@tianon
Copy link
Member

tianon commented Jan 16, 2024

This is probably related to ef1774b (compose update) specifically 🤔

(which means the answer is probably somewhere in docker/compose@v2.23.3...v2.24.0 😅)

@tianon
Copy link
Member

tianon commented Jan 16, 2024

Ah, specifically docker/compose@fb3868f, thus docker/compose#10939

@cjlarose
Copy link
Author

Ah, makes sense. The version check is a little too aggressive

@cjlarose
Copy link
Author

After tracking down the progress on StartInterval in moby/moby#45897, it's clear that Docker 25.0 will indeed be the first version to properly support the new option.

For me, what was happening is that start_interval wasn't supported by docker compose prior to v2.24, but the old version would silently ignore it. With compose version 2.24, the new option is supported, but with throw an error if using a Docker Engine that doesn't support it.

I think this isn't technically a bug. It was really unexpected that upgrading docker compose broke my builds, but technically, I was trying to do something that wasn't supported anyway.

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

No branches or pull requests

2 participants