Is there a way to create health check in docker compose?
I use docker compose to run image and I can't find a way to create health check. For example, when I use redis I can create healthcheck like:
version: '3.8'
services:
redis:
restart: always
image: redis:6.2-alpine
....
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 10
....
Is there some command that can be used for healthcheck to restart container if something wrong inside?
you can use ps aux and grep for postfix dkim etc.
those are the services you should need to check
service rsyslog start
if [ -z ${DISABLE_DKIM+x} ]
then
service opendkim start
fi
service saslauthd start
service postfix start
Not sure that it's what I mean. Sometimes I see that container is up and all processes are running, but I can't connect to the container from another container (with java client) to send emails. And I have to restart container manually. Instead of that I would like to call some command every 5 seconds to check everything working in container.