Merge pull request #898 from gtardif/aci_healthcheck_doc

Updated health check docs
This commit is contained in:
Guillaume Tardif 2020-11-10 17:07:42 +01:00 committed by GitHub
commit c67e4f6e50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 6 deletions

View File

@ -47,7 +47,7 @@ __Legend:__
| service.external_links | x |
| service.extra_hosts | x |
| service.group_add | x |
| service.healthcheck | ✓ |
| service.healthcheck | ✓ |
| service.hostname | x |
| service.image | ✓ | Private images will be accessible if the user is logged into the corresponding registry at deploy time. Users will be automatically logged in to Azure Container Registry using their Azure login if possible.
| service.isolation | x |
@ -173,7 +173,7 @@ secrets:
file: ./my_secret2.txt
```
In this example the `nginx` service will have its secret mounted in `/run/secrets/renamedsecret1.txt` and `db` will have 2 files (`mysecretonmount1.txt` and `mysecretonmount2.txt`).
In this example the `nginx` service will have its secret mounted to `/run/secrets/renamedsecret1.txt` and `db` will have 2 files (`mysecretonmount1.txt` and `mysecretonmount2.txt`).
Both of them with be mounted in the same folder (`/mnt/dbmount/`).
@ -212,12 +212,16 @@ The web container will have its limits set to the same values as reservations, b
## 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.
A health check can be described in the `healthcheck` section of each service. This is translated to a `LivenessProbe` in ACI. If the health check fails then the container is considered unhealthy and terminated.
In order for the container to be restarted automatically, the service needs to have a restart policy other than `none` to be set. Note that the default restart policy if one isn't set is `any`.
```yaml
services:
web:
image: nginx
deploy:
restart_policy:
condition: on-failure
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 30s
@ -226,4 +230,4 @@ services:
start_period: 40s
```
**Note:** that the `test` command can be a `string` or an array starting or not by `NONE`, `CMD`, `CMD-SHELL`. In the ACI implementation, these prefixes are ignored.
**Note:** that the `test` command can be a `string` or an array starting or not by `NONE`, `CMD`, `CMD-SHELL`. In the ACI implementation, these prefixes are ignored.

View File

@ -22,11 +22,16 @@ __Legend:__
| --domainname | ✓ | See [Exposing ports](#exposing-ports).
| --e, --env | ✓ | Sets environment variable.
| --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.
| -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.
| -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).
| -v, --volume | ✓ | See [Persistent Volumes](#persistent-volumes).
@ -53,7 +58,7 @@ Credentials for storage accounts will be automatically fetched at deployment tim
CPU and memory reservations can be set when running containers with `docker run --cpus 1.5 --memory 2G`.
It is not possible to set resource limits that differ from resource reservation on single containers.
It is not possible to set resource limits that differ from resource reservation on single containers.
ACI allows setting resource limits for containers in a container group but these limits must stay within the reserved resources for the entire group. In the case of a single container deployed in a container group, the resource limits must be equal to the resource reservation.
## Logs
@ -63,3 +68,10 @@ You can view container logs with the command `docker logs <CONTAINER-ID>`.
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.
> 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
A health check can be described using the flags prefixed by `--healthcheck`. This is translated into `LivenessProbe` for ACI. If the health check fails then the container is considered unhealthy and terminated.
In order for the container to be restarted automatically, the container needs to be run with a restart policy (set by the `--restart` flag) other than `no`. Note that the default restart policy if one isn't set is `no`.
In order to restart automatically, the container also need to have a restart policy set with `--restart` (`docker run` defaults to no restart policy)