|
|
@@ -1,6 +1,7 @@ |
|
|
|
## Docker Swarm health check example |
|
|
|
|
|
|
|
This example shows how health check works in Docker Swarm. |
|
|
|
This example shows how health check works in Docker Swarm and how it heals |
|
|
|
the service. |
|
|
|
|
|
|
|
### What does this container do? |
|
|
|
|
|
|
@@ -39,6 +40,10 @@ docker service create \ |
|
|
|
|
|
|
|
### Watching the health check |
|
|
|
|
|
|
|
First, the container will start in ``unhealthy`` mode as expected, health check |
|
|
|
will pick this and Docker Swarm will restart that container which then will |
|
|
|
start in a ``healthy`` mode. |
|
|
|
|
|
|
|
``` |
|
|
|
docker ps |grep test1 |
|
|
|
docker service ls |
|
|
@@ -49,7 +54,7 @@ docker service ls |
|
|
|
``` |
|
|
|
docker service rm test1 |
|
|
|
docker swarm leave --force |
|
|
|
rm -f -- /tmp/status |
|
|
|
sudo rm -f -- /tmp/status |
|
|
|
docker rmi healthcheck-test |
|
|
|
``` |
|
|
|
|
|
|
|