health check docker code example
Example: docker healthcheck
version: "3.8"
services:
image: "node:14-alpine"
healthcheck:
interval: 120s
retries: 5
start_period: 60s
test: |
touch healthcheck.txt &&
mkdir healthcheck &&
mv healthcheck.txt healthcheck &&
cd healthcheck &&
echo "hello my docker container is working fine" >> healthcheck.txt &&
cat healthcheck.txt &&
sleep 5 &&
rm "${PWD}/healthcheck.txt" &&
cd .. &&
sleep 5 &&
rmdir "${PWD}/healthcheck" &&
exit 0
timeout: 30s