diff --git a/README.md b/README.md index bc30e28..8fd7528 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ You can set Shepherd to roll back a service to the previous version if the updat You can control additional parameters for the `docker service update` and `docker service update --rollback` calls using the variables `UPDATE_OPTIONS` and `ROLLBACK_OPTIONS`. +If the `docker service update` takes too long then it will be killed after 5 minutes by default. You can adjust this value using the `TIMEOUT` variable. + You can enable private registry authentication by setting the `WITH_REGISTRY_AUTH` variable. If you need to authenticate to a registry (for example in order to get around the [Docker Hub rate limits](https://www.docker.com/increase-rate-limit)), you can set the variable `REGISTRY_USER` and store the password either in a [docker secret](https://docs.docker.com/engine/swarm/secrets/) named `shepherd_registry_password` or in the environment variable `REGISTRY_PASSWORD`. If you are not using Docker Hub but a private registry, set `REGISTRY_HOST` to the hostname of your registry. diff --git a/shepherd b/shepherd index ee3a2a9..b8c1578 100755 --- a/shepherd +++ b/shepherd @@ -98,7 +98,7 @@ update_services() { logger "Trying to update service $name with image $image" "true" # shellcheck disable=SC2086 - if ! docker "${config_flag[@]}" service update "$name" $detach_option $registry_auth $no_resolve_image_flag ${UPDATE_OPTIONS} --image="$image" > /dev/null; then + if ! timeout "${TIMEOUT:-300}" docker "${config_flag[@]}" service update "$name" $detach_option $registry_auth $no_resolve_image_flag ${UPDATE_OPTIONS} --image="$image" > /dev/null; then logger "Service $name update failed on $hostname!" if [[ "${ROLLBACK_ON_FAILURE+x}" ]]; then logger "Rolling $name back"