Which version of the file specification is compose using in the case?
version: "3.0"
services:
db:
image: docker.feedzai.com/hub-proxy/library/postgres:11
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
app:
image: docker.feedzai.com/hub-proxy/library/postgres:11
healthcheck:
test: ["CMD-SHELL", "app_isready"]
interval: 10s
timeout: 5s
retries: 5
depends_on:
db:
condition: service_healthy
According to the documentation , condition
is no longer supported in docker-compose file version 3. But this configuration works and if I run docker-compose config I still see the version 3.0 there.
According to the specs, which joins version 2 and 3, this is valid syntax, but for what I understand, the file can use any syntax, and compose will select the version to fit that configuration. So, how can I know which version compose is choosing to interpret this file?
How I reproduce this issue
# Got a docker with ubuntu jammmy
docker run --rm -it --entrypoint /bin/bash ubuntu:jammy-20220531
>
#Install docker-compose inside the container (v. 1.29.2)
> apt-get update && apt-get install docker-compose
> docker-compose -v
docker-compose version 1.29.2, build unknown
# copy the above file to the container (from another terminal)
docker cp docker-compose.yml <container id>:
# run docker-compose config to validate the configuration file
> docker-compose config
services:
app:
depends_on:
db:
condition: service_healthy
healthcheck:
interval: 10s
retries: 5
test:
- CMD-SHELL
- app_isready
timeout: 5s
image: docker.feedzai.com/hub-proxy/library/postgres:11
db:
healthcheck:
interval: 10s
retries: 5
test:
- CMD-SHELL
- pg_isready
timeout: 5s
image: docker.feedzai.com/hub-proxy/library/postgres:11
version: '3.0'