containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
5.01k stars 477 forks source link

Fails to handle the `service_healthy` condition of a `depends_on` element #866

Open candleindark opened 7 months ago

candleindark commented 7 months ago

Describe the bug podman-compose fails to handle the service_healthy condition of a depends_on element.

To Reproduce Steps to reproduce the behavior:

  1. Create the following docker-compose.yml file
services:
  base:
    image: docker.io/debian
    command: [ "tail", "-f", "/dev/null" ]
    healthcheck:
      test: [ "CMD", "false" ]
      interval: 30s
      timeout: 30s
      retries: 3
      start_period: 1m

  dependent:
    image: docker.io/debian
    depends_on:
      base:
        condition: service_healthy
    command: [ "tail", "-f", "/dev/null" ]
  1. Run podman-compose -f docker-compose.yml up -d in the containing directory

Expected behavior The container corresponding to the dependent service never starts since the base can never be healthy.

Actual behavior The container corresponding to the dependent service always starts.

Output

podman-compose version
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.3.1
podman-compose version 1.0.6
podman --version 
podman version 4.3.1
exit code: 0

Environment:

pfeileon commented 2 months ago

Could be a duplicate, as the correct implementation of healthchecks is actually a 5-year-old issue: https://github.com/containers/podman-compose/issues/23