Skip to content

Commit 85aacd3

Browse files
committed
Merge branch 'fix/autoheal' into 'master'
Make sure the health check only fails once (/tmp/ dir is not cleaned up on restart) See merge request grafolean/grafolean-collector-snmp!12
2 parents 87118ef + 3f94442 commit 85aacd3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ RUN \
4040
echo "alias l='ls -altr'" >> /root/.bashrc
4141
COPY --from=build-backend /snmpcollector/ /snmpcollector/
4242
WORKDIR /snmpcollector
43-
HEALTHCHECK --interval=10s --retries=1 CMD /bin/bash -c "[ ! -f /tmp/fail_health_check ]"
43+
# check for "fail" file and if it exists, remove it and fail the check:
44+
HEALTHCHECK --interval=10s --retries=1 CMD /bin/bash -c "[ ! -f /tmp/fail_health_check ] || ( rm /tmp/fail_health_check && exit 1 )"
4445
CMD ["python", "-m", "snmpcollector"]

docker-compose.dev.yml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ services:
4747
container_name: autoheal-snmp
4848
environment:
4949
- AUTOHEAL_CONTAINER_LABEL=all
50+
- AUTOHEAL_INTERVAL=5 # check every 5 seconds - this must be lower than the period of Docker container HEALTHCHECK we are monitoring
5051
volumes:
5152
- /var/run/docker.sock:/var/run/docker.sock
5253
restart: always

0 commit comments

Comments
 (0)