Skip to content

Commit 06cc809

Browse files
Merge pull request #43 from wandersonwhcr/feature/docker-exit
Docker Exit
2 parents 7c35191 + 2ed6e79 commit 06cc809

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This POSIX compliant sh script gets php-fpm status page using `cgi-fcgi` tool, p
77
- [Motivation](#motivation)
88
- [Installation](#installation)
99
- [Usage](#usage)
10+
- [Docker example](#docker-example)
1011
- [Kubernetes example](#kubernetes-example)
1112
- [Why POSIX sh?](#why-posix-sh)
1213
- [Author and License](#author)
@@ -155,6 +156,18 @@ $ echo $?
155156
0
156157
```
157158

159+
## Docker example
160+
161+
You can use `HEALTHCHECK` command on `Dockerfile` to define the health of your
162+
container. According to (Docker Docs)[https://docs.docker.com/engine/reference/builder/#healthcheck],
163+
possible return values are `0` for success, `1` to unhealthy and `2` is reserved
164+
and we **must not** use this exit code.
165+
166+
```Dockerfile
167+
HEALTHCHECK --interval=5s --timeout=1s \
168+
CMD php-fpm-healthcheck || exit 1
169+
```
170+
158171
## Kubernetes example
159172

160173
More and more people are looking for health checks on kubernetes for php-fpm, here is an example of livenessProbe and readinessProbe:
@@ -191,6 +204,9 @@ More and more people are looking for health checks on kubernetes for php-fpm, he
191204
periodSeconds: 5
192205
```
193206
207+
Docker `HEALTHCHECK` command is ignored on Kubernetes and you must define it
208+
using pod specifications.
209+
194210
## Why POSIX sh
195211

196212
Most of the containers contain limited software installed, using POSIX sh aims to be compatible with most of the OS images around.

0 commit comments

Comments
 (0)