Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker compose up, retry pull images

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?

like image 393
ClickThisNick Avatar asked Nov 21 '17 14:11

ClickThisNick


People also ask

What is Depends_on in docker compose?

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.

Does docker compose up pull images?

The docker-compose spec says: pull_policy defines the decisions Compose implementations will make when it starts to pull images.

Does docker compose restart failed containers?

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.


1 Answers

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
like image 195
Gustavo Kawamoto Avatar answered Sep 17 '22 23:09

Gustavo Kawamoto