Advertisement
aldikhan13

Docker Simple HealthCheck Method

Apr 15th, 2021 (edited)
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. version: "3.8"
  2. services:
  3. image: "node:14-alpine"
  4. healthcheck:
  5. interval: 120s
  6. retries: 5
  7. start_period: 60s
  8. test: |
  9. touch /tmp/healthcheck.txt &&
  10. mkdir /tmp/healthcheck &&
  11. mv /tmp/healthcheck.txt /tmp/healthcheck &&
  12. cd /tmp/healthcheck &&
  13. echo "hello my docker container is working fine" >> healthcheck.txt &&
  14. cat healthcheck.txt &&
  15. sleep 3 &&
  16. rm "${PWD}/healthcheck.txt"
  17. cd .. &&
  18. sleep 3 &&
  19. rmdir "${PWD}/healthcheck" &&
  20. exit 0
  21. timeout: 30s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement