准备环境
容器本身有一个健康检查的功能,但是需要在Dockerfile
里定义,或者在执行docker run
的时候,通过下面的一些参数指定。
--health-cmd string Command to run to check health
--health-interval duration Time between running the check (ms|s|m|h) (default 0s)
--health-retries int Consecutive failures needed to report unhealthy
--health-start-period duration Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)
--health-timeout duration Maximum time to allow one check to
原创大约 3 分钟