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

Service healthy not working as expected. #1129

Open
albertaillet opened this issue Feb 4, 2025 · 0 comments
Open

Service healthy not working as expected. #1129

albertaillet opened this issue Feb 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@albertaillet
Copy link

Describe the bug
A service that depends on the health of another service starts even though the service is not healthy.

To Reproduce
Steps to reproduce the behavior:

  1. what is the content of the current working directory (ex. docker-compose.yml, .env, Dockerfile, ...etc.)
version: "3.9"

services:
  service1:
    image: alpine
    container_name: service1
    healthcheck:
      test: [ "CMD-SHELL", "exit 1" ]
    command: echo "Hello from service1"

  service2:
    image: alpine
    container_name: service2
    depends_on:
      service1:
        condition: service_healthy
    command: echo "Hello from service2"

I typed this command:

podman compose up

Expected behavior
I would expect only service1 to start as the health check of service1 is exit 1 (which refers to unhealthy - the container isn't working correctly: https://docs.docker.com/reference/dockerfile/#healthcheck)

Actual behavior
Both service1 and service2 start.

Output

$ podman-compose version
➤ podman compose version
>>>> Executing external compose provider "/usr/bin/podman-compose". Please see podman-compose(1) for how to disable this message. <<<<
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 5.2.2
podman-compose version 1.0.6
podman --version
podman version 5.2.2
exit code: 0

$ podman-compose up
exit code: 0
podman start -a service1
[service1] | Hello from service1
exit code: 0
podman start -a service2
[service2] | Hello from service2
exit code: 0

Environment:

  • OS: Linux
  • podman version: 5.2.2
  • podman compose version: 1.0.6
@albertaillet albertaillet added the bug Something isn't working label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant