Timeout in case of one-shot container #19
Description
I have 7 services in my docker-compose.swarm.yml
. Everything run as a daemon except storage-minio-client
service.
The storage-minio-client
acts like a one-shot container - executes command defined by an entrypoint and exits.
storage-minio-client:
image: ${CI_REGISTRY}/service/storage/minio:client
networks:
- local
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.worker-stateless == 1
The image was build from Dockerfile:
FROM bitnami/minio-client
COPY setup-buckets.sh /tmp/setup-buckets.sh
ENTRYPOINT ["/tmp/setup-buckets.sh"]
The setup-buckets.sh
creates buckets and exits with code 0.
This kind of container causes docker-stack-wait
to timeout, however services were deployed successfully.
Also, Portainer shows complete status for the storage-minio-client
service.
Logs from the script:
13:19:16 Status: Downloaded newer image for sudobmitch/docker-stack-wait:latest
13:19:17 Service storage-minio3 state: deployed
13:19:17 Service storage-minio4 state: deployed
13:19:17 Service storage-minio1 state: deployed
13:19:17 Service storage-minio-client state: replicating 0/1
13:19:17 Service storage-minio2 state: deployed
13:19:17 Service storage-nginx state: deployed
13:19:17 Service storage-php-web state: deployed
14:19:24 Error: Timeout exceeded
Looks like the script expects all services are in running state.
P.S. I found a workaround - added sleep 300
in my bash script that keeps the storage-minio-client
container running, so the docker-stack-wait
finishes successfully.
P.P.S. Similar issue was reported earlier.