feat(docker-compose): wait for docker to be running before loading docker-compose file (#1960)

* feat(docker-compose): wait for docker to be running before trying to load docker-compose file

* hmm

* hmm

* shellcheck

* hmm
This commit is contained in:
Kjeld Schouten-Lebbing
2022-02-24 23:32:31 +01:00
committed by GitHub
parent a9b7e9d61f
commit 5972267b8e
2 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ name: docker-compose
sources: sources:
- https://github.com/Jackett/Jackett - https://github.com/Jackett/Jackett
type: application type: application
version: 0.0.4 version: 0.0.5
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- docker - docker
+13 -8
View File
@@ -1,7 +1,7 @@
image: image:
repository: tccr.io/truecharts/docker-in-docker repository: tccr.io/truecharts/docker-in-docker
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
tag: v20.10.12@sha256:c62daf2fbd0b520a5849a5b463b059207e3669c892131eff1f0cf22d3b053deb tag: v20.10.12@sha256:06af3ce416ac5d30697178378f164a9a9494bc5dcb182b0f441ed9f5087a5fe7
controller: controller:
# -- Set the controller type. # -- Set the controller type.
@@ -53,15 +53,20 @@ lifecycle:
postStart: postStart:
exec: exec:
command: command:
- "/bin/sh" - "/bin/bash"
- "-c" - "-c"
- > - |
sleep 20 && if [ ${COMPOSE_FILE} ]; then if [ "${COMPOSE_FILE}" ]; then
docker-compose up -d -f ${COMPOSE_FILE} && echo "Loading COMPOSE_FILE at location ${COMPOSE_FILE}" >> /proc/1/fd/1; counter=0;
else echo "COMPOSE_FILE not set, not auto-loading compose-file" >> /proc/1/fd/1; while ! docker info > /dev/null 2>&1 && [[ ${counter} -lt 10 ]]; do
echo "docker not running yet. Waiting..." >> /proc/1/fd/1;
sleep 5;
counter=$((counter+1));
done
docker-compose up -d -f "${COMPOSE_FILE}" && echo "Loading COMPOSE_FILE at location ${COMPOSE_FILE}" >> /proc/1/fd/1;
else
echo "COMPOSE_FILE not set, not auto-loading compose-file" >> /proc/1/fd/1;
fi fi
probes: probes:
liveness: liveness:
spec: spec: