Open Iamzz-cn opened 3 years ago
This is working as intended.
docker run
does not do anything at all with healchecks except run them and report the output.
docker service
is an orchestration system which uses healthchecks specifically to check availability and react accordingly.
Expected behavior
The intention of the
HEALTHCHECK
command is to check the health status of the container every 5m after the container is started. When I added theHEALTHCHECK
instruction to theDockerfile
to clear the way ofdocker run image-name...
, my container would immediately become available. Throughdocker service create iamge-name...
service
will become available immediately.Actual behavior
In fact, the container can be used only when it enters the state of
healthy
through the method ofdocker service create image-name
.Steps to reproduce the behavior
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.)
I have the same problem on MAC, WINDOWS (wsl2&&local), LINUX (Centos7)