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

Container dependencies are not satisfied with multi-level dependent one-off container #683

Open
skateman opened this issue Apr 27, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@skateman
Copy link

Describe the bug
When a container depends on a one-off task container that depends on another container, e.g. a web server depending on DB migrations depending on a database, its dependency graph gets broken as soon as the one-off task exits, regardless of its exit code.

This issue was not present in version 1.0.3 and it was introduced in 1.0.6.

To Reproduce

version: "3"
services:
  first:
    image: docker.io/library/alpine
    command: sleep infinity
  second:
    image: docker.io/library/alpine
    command: whoami
    depends_on:
      - first
  third:
    image: docker.io/library/alpine
    command: sleep infinity
    depends_on:
      - first
      - second

Expected behavior
The first and third services run properly and the second one exits successfully.

Actual behavior
The dependency graph gets broken as the third service depending on the second cannot be started.

Output

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


$ podman-compose up
...
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=test', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
['podman', 'network', 'exists', 'test_default']
podman run --name=test_first_1 -d --label io.podman.compose.config-hash=48081b958c63b73cedfc896d9abff3afb926613125ab6be217a659695dc7fd5f --label io.podman.compose.project=test --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@test.service --label com.docker.compose.project=test --label com.docker.compose.project.working_dir=/home/skateman/Repositories/Insights/test --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=first --net test_default --network-alias first docker.io/library/alpine sleep infinity
b86fe2a66161c19c047b258f048304b938596863cf36550adcd842a4f7c0243c
exit code: 0
['podman', 'network', 'exists', 'test_default']
podman run --name=test_second_1 -d --requires=test_first_1 --label io.podman.compose.config-hash=48081b958c63b73cedfc896d9abff3afb926613125ab6be217a659695dc7fd5f --label io.podman.compose.project=test --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@test.service --label com.docker.compose.project=test --label com.docker.compose.project.working_dir=/home/skateman/Repositories/Insights/test --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=second --net test_default --network-alias second docker.io/library/alpine whoami
838e3b41454619be5ef67740e646efb361bc9f11a6e2414ab86b887b85b825fd
exit code: 0
['podman', 'network', 'exists', 'test_default']
podman run --name=test_third_1 -d --requires=test_second_1,test_first_1 --label io.podman.compose.config-hash=48081b958c63b73cedfc896d9abff3afb926613125ab6be217a659695dc7fd5f --label io.podman.compose.project=test --label io.podman.compose.version=1.0.6 --label PODMAN_SYSTEMD_UNIT=podman-compose@test.service --label com.docker.compose.project=test --label com.docker.compose.project.working_dir=/home/skateman/Repositories/Insights/test --label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=third --net test_default --network-alias third docker.io/library/alpine sleep infinity
Error: generating dependency graph for container 59713c8008dfab964ab9de7019221c2c444867b66a06bd8e7e63348e3dc2a302: container 838e3b41454619be5ef67740e646efb361bc9f11a6e2414ab86b887b85b825fd depends on container b86fe2a66161c19c047b258f048304b938596863cf36550adcd842a4f7c0243c not found in input list: no such container
exit code: 127
podman start test_third_1
Error: unable to start container "59713c8008dfab964ab9de7019221c2c444867b66a06bd8e7e63348e3dc2a302": generating dependency graph for container 59713c8008dfab964ab9de7019221c2c444867b66a06bd8e7e63348e3dc2a302: container 838e3b41454619be5ef67740e646efb361bc9f11a6e2414ab86b887b85b825fd depends on container b86fe2a66161c19c047b258f048304b938596863cf36550adcd842a4f7c0243c not found in input list: no such container
exit code: 125

Environment:

  • OS: Linux (Fedora 37)
  • podman version: 4.5.0
  • podman compose version: 1.0.6

Additional context

$ podman-compose ps
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.5.0
podman ps -a --filter label=io.podman.compose.project=test
CONTAINER ID  IMAGE                            COMMAND         CREATED        STATUS                    PORTS       NAMES
8bcf6ca32b74  docker.io/library/alpine:latest  sleep infinity  6 seconds ago  Up 7 seconds                          test_first_1
ef75a020d3dc  docker.io/library/alpine:latest  whoami          5 seconds ago  Exited (0) 5 seconds ago              test_second_1
0ac117f663ef  docker.io/library/alpine:latest  sleep infinity  3 seconds ago  Created                               test_third_1
exit code: 0
@skateman skateman added the bug Something isn't working label Apr 27, 2023
@skateman
Copy link
Author

I traced this back to #425 and d6e21dc, apparently --requires doesn't take into account one-off containers 😞

@feeihoa
Copy link

feeihoa commented Dec 15, 2023

@skateman Hi! Did you manage to find a solution?

@skateman
Copy link
Author

Not really, I am using docker-compose instead...colleagues went with donwgrading.

@SohanTirpude
Copy link

This issue is still seen

@Renlor
Copy link

Renlor commented May 8, 2024

This is still an issue, just ran into it today trying to migrate a project from docker-compose to podman-compose.

@dev01-isarflow
Copy link

Still an issue with using podman version: 4.9.4

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

5 participants