We sometimes get Client.Timeout exceeded while awaiting headers
errors when running docker-compose up
as its pulling images.
Is there a way to get docker-compose to retry when it is pulling an image?
depends_on is a Docker Compose keyword to set the order in which services must start and stop. For example, suppose we want our web application, which we'll build as a web-app image, to start after our Postgres container.
The docker-compose spec says: pull_policy defines the decisions Compose implementations will make when it starts to pull images.
no: Containers will not restart automatically. on-failure[:max-retries]: Restart the container if it exits with a non-zero exit code and provide a maximum number of attempts for the Docker daemon to restart the container.
Using only docker-compose
, no.
The docker-compose
command does not specifically exposes a flag for retrying pulling the images, but you can always use bash magic for that:
while ! docker-compose pull; do sleep .1; done && docker-compose up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With