Updated health check docs

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-11-10 15:37:07 +01:00
parent 1cc0ccb189
commit ef5e78dc14
2 changed files with 19 additions and 5 deletions

View File

@ -212,12 +212,16 @@ The web container will have its limits set to the same values as reservations, b
## Healthchecks ## Healthchecks
Healthchecks can be described in the `healthcheck` section in the service. It translates to `LivenessProbe` in ACI. By that, the container is restarted if it becomes unhealthy. Healthchecks can be described in the `healthcheck` section in the service. It translates to `LivenessProbe` in ACI. By that, the container is terminated if it becomes unhealthy.
In order to restart automatically, the container also need to have a restart policy not set to "none"
```yaml ```yaml
services: services:
web: web:
image: nginx image: nginx
deploy:
restart_policy:
condition: on-failure
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"] test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 30s interval: 30s

View File

@ -22,11 +22,16 @@ __Legend:__
| --domainname | ✓ | See [Exposing ports](#exposing-ports). | --domainname | ✓ | See [Exposing ports](#exposing-ports).
| --e, --env | ✓ | Sets environment variable. | --e, --env | ✓ | Sets environment variable.
| --env-file | ✓ | Sets environment variable from and external file. | --env-file | ✓ | Sets environment variable from and external file.
| --health-cmd | ✓ | Specify healthcheck command. See [Healthchecks](#healthchecks).
| --health-interval | ✓ | Specify healthcheck interval
| --health-retries | ✓ | Specify healthcheck number of retries
| --health-start-period | ✓ | Specify healthcheck initial delay
| --health-timeout | ✓ | Specify healthcheck timeout
| -l, --label | x | Unsupported in Docker ACI integration, due to limitations of ACI Tags. | -l, --label | x | Unsupported in Docker ACI integration, due to limitations of ACI Tags.
| -m, --memory | ✓ | See [Container Resources](#container-resources). | -m, --memory | ✓ | See [Container Resources](#container-resources).
| --name | ✓ | Provide a name for the container. Name must be unique withing the ACI resource group. a name is generated by default. | --name | ✓ | Provide a name for the container. Name must be unique withing the ACI resource group. a name is generated by default.
| -p, --publish | ✓ | See [Exposing ports](#exposing-ports). Only symetrical port mapping is supported in ACI. | -p, --publish | ✓ | See [Exposing ports](#exposing-ports). Only symetrical port mapping is supported in ACI.
| --restart | ✓ | Restart policy, must be one of: `any`, `none`, `on-failure`. | --restart | ✓ | Restart policy, must be one of: `always`, `no`, `on-failure`.
| --rm | x | Not supported as [ACI does not support auto-delete containers](https://feedback.azure.com/forums/602224-azure-container-instances/suggestions/34066633-support-auto-delete-of-aci-when-container-exits-no). | --rm | x | Not supported as [ACI does not support auto-delete containers](https://feedback.azure.com/forums/602224-azure-container-instances/suggestions/34066633-support-auto-delete-of-aci-when-container-exits-no).
| -v, --volume | ✓ | See [Persistent Volumes](#persistent-volumes). | -v, --volume | ✓ | See [Persistent Volumes](#persistent-volumes).
@ -63,3 +68,8 @@ You can view container logs with the command `docker logs <CONTAINER-ID>`.
You can follow logs with the `--follow` (`-f`) option. You can follow logs with the `--follow` (`-f`) option.
When running a container with `docker run`, by default the command line stays attached to container logs when the container starts. Use `docker run --detach` to not follow logs once the container starts. When running a container with `docker run`, by default the command line stays attached to container logs when the container starts. Use `docker run --detach` to not follow logs once the container starts.
> Note: Following ACI logs may have display issues especially when resizing a terminal that is following container logs. This is due to ACI providing raw log pulling but no streaming of logs. Logs are effectively pulled every 2 seconds when following logs. > Note: Following ACI logs may have display issues especially when resizing a terminal that is following container logs. This is due to ACI providing raw log pulling but no streaming of logs. Logs are effectively pulled every 2 seconds when following logs.
## Healthchecks
Healthchecks can be described with the `--healthcheck-xxx` flags. It translates to `LivenessProbe` in ACI. By that, the container is terminated if it becomes unhealthy.
In order to restart automatically, the container also need to have a restart policy set with `--restart` (`docker run` defaults to no restart policy)