Help with healthcheck on redis container
Closed this issue · 6 comments
I can't work out why the redis container (named unbound-db in my setup) is saying it is unhealthy but I think it is fine.
I added an additional check to debug in healthcheck.sh and when I run the script using docker exec - it seems to be ok.
here is my updated healthcheck.sh
#! /bin/sh
SOCKET=/usr/local/unbound/cachedb.d/redis.sock
if [[ ! -S "$SOCKET" ]];
then
echo "$SOCKET is not a file/socket so exit 1"
exit 1
else
echo "$SOCKET is a file/socket so do nothing"
fi
Below is from the cli - and it looks to be confirming the container is healthy. Or am I missing something (very likely)
It looks good, I'd take a look at the configs you use if you like.
Have been in the office and haven't found the cause or solution. I think startup order is correct and the healthcheck test seems to be good.
startup order is unbound-socket --> unbound-db --> unbound
Here is my full config.
version: '3.3'
services:
unbound:
container_name: unbound
image: madnuttah/unbound:latest
restart: unless-stopped
depends_on:
- unbound-db
ports:
- 5335:5335/tcp
- 5335:5335/udp
networks:
rpi5_macvlan:
ipv4_address: "192.168.100.15"
environment:
ServerIP: 192.168.100.15
TZ: ${TZ}
UID: ${PUID}
GID: ${PGID}
volumes:
- /symlinks/omv-system/appdata/unbound/unbound.conf:/usr/local/unbound/unbound.conf:rw
- /symlinks/omv-system/appdata/unbound/conf.d/:/usr/local/unbound/conf.d/:rw
- /symlinks/omv-system/appdata/unbound/iana.d/:/usr/local/unbound/iana.d/:rw
- /symlinks/omv-system/appdata/unbound/log.d/unbound.log:/usr/local/unbound/log.d/unbound.log:rw
- /symlinks/omv-system/appdata/unbound/zones.d/:/usr/local/unbound/zones.d/:rw
volumes_from:
- unbound-socket:rw
healthcheck:
test: /usr/local/unbound/sbin/healthcheck.sh
interval: 60s
retries: 5
start_period: 15s
timeout: 30s
unbound-socket:
image: busybox
container_name: unbound-socket
restart: unless-stopped
tty: true
command:
- /bin/sh
- -c
- |
chown -R 999:100 /usr/local/unbound/cachedb.d/
/bin/sh
volumes:
- cachedb.d:/usr/local/unbound/cachedb.d/
unbound-db:
container_name: unbound-db
image: redis:alpine
restart: unless-stopped
depends_on:
- unbound-socket
command: redis-server /usr/local/etc/redis/redis.conf
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- /symlinks/omv-system/appdata/unbound/redis/redis.conf:/usr/local/etc/redis/redis.conf
- /symlinks/omv-system/appdata/unbound/redis/data:/data
- /symlinks/omv-system/appdata/unbound/redis/healthcheck.sh:/usr/local/sbin/healthcheck.sh:ro
volumes_from:
- unbound-socket:rw
healthcheck:
test: /usr/local/sbin/healthcheck.sh
interval: 10s
retries: 5
start_period: 5s
timeout: 30s
volumes:
cachedb.d:
networks:
rpi5_macvlan:
name: rpi5_macvlan
external: true
Will try that. Thanks.
I think you know already but everything is running/working it’s just health check says unhealthy when it is healthy
I've removed that because it wasn't the issue after testing. My apologies, I should better have edited my answer.
Anyway, I've added my compose stack to the examples here, may you find something while comaring?
Being honest, I have no idea other than that, since it runs for other users and myself, too. If you found the issue and it's something I could make better, feel free to reopen this issue or create PR with your suggested improvements.
I'll close this for now.
Thank you.