Skip to content

Add wait command to docker compose #10395

@chmely

Description

@chmely

Description

It would be nice to be able to start compose in detached mode and then be able to wait for a specific service(s) to finish, similar to what docker wait does.

Something like docker compose [params] wait service [service] [--timeout xx]
Return code - 0 if all awaited services completed successfully within the required time frame, error code otherwise

Why this could be useful?

We use compose in our CI pipeline where we want to start certain containers like LocalStack, Vault, etc. Then we have seeder containers that run as part of the compose and seed values or initialize infrastructure inside LocalStack.
After the seeding/initialization is done we run our integrations tests. But before we can run our integration tests we have to make sure the seeder containers have finished successfully.

So in our case it'd be great if we could do something like

docker compose [params] --profile infrastructure --profile localstack-seeder --profile vault-seeder up -d
docker compose [params] --profile infrastructure --profile localstack-seeder --profile vault-seeder wait localstack-seeder vault-seeder --timeout 60s

run integration tests here if $? is 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions