containers/podman-compose

Add support for podman-compose up --wait option

avisiedo opened this issue · 0 comments

Describe the solution you'd like
Add the --wait option for podman-compose up as indicated at: https://docs.docker.com/engine/reference/commandline/compose_up/#options so it get closer to docker-compose interface. This will make easier the synchronization when automating podman-compose commands.

Describe alternatives you've considered
The workaround I am using on scenarios where I need the container to be in healthy state is a loop kind of:

.PHONY: .compose-wait-db                                                           
.compose-wait-db:                                                                  
    @printf "Waiting database"; \                                                  
    while [ "$$( podman container inspect --format '{{.State.Health.Status}}' "$(DOCKER_COMPOSE_PROJECT)_database_1" )" != "healthy" ]; \  
    do sleep 1; printf "."; \                                                      
    done; \                                                                        
    printf "\n"  

The container indicated there has a health check section defined in the docker-compose.yaml file.

Additional context

Using podman-version 1.0.6:

$ 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

Below the part of the docker-compose.yaml definition that I am using:

# https://docs.docker.com/compose/compose-file/compose-file-v2/
# https://docs.docker.com/compose/compose-file/compose-file-v3/
---
version: "2.4"
services:
  database:
    image: docker.io/postgres:13
    environment:
      - POSTGRES_USER=${DATABASE_USER}
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
      - POSTGRES_DB=${DATABASE_NAME}
    ports:
      - ${DATABASE_EXTERNAL_PORT}:5432/tcp
    volumes:
      - database:/var/lib/postgresql/data
    healthcheck:
      test: "pg_isready"
      interval: 5s
      timeout: 3s
      retries: 10
      start_period: 3s
volumes:
  database: