Regression in docker-compose: can't set healthcheck.start_interval as feature require Docker Engine 1.25 or later
cjlarose opened this issue · 4 comments
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
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 😅)
Ah, specifically docker/compose@fb3868f, thus docker/compose#10939
Ah, makes sense. The version check is a little too aggressive
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.