Add "mongo"

This commit is contained in:
Tianon Gravi 2016-06-13 14:15:10 -07:00
parent 0fb5aa14e7
commit a5e5a6e9f3
2 changed files with 15 additions and 0 deletions

5
mongo/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM mongo
COPY docker-healthcheck /usr/local/bin/
HEALTHCHECK CMD ["docker-healthcheck"]

10
mongo/docker-healthcheck Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -eo pipefail
if mongo --quiet localhost --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'; then
exit 0
fi
# If the probe returns 2 ("starting") when the container has already moved out of the "starting" state then it is treated as "unhealthy" instead.
# https://github.com/docker/docker/blob/dcc65376bac8e73bb5930fce4cddc2350bb7baa2/docs/reference/builder.md#healthcheck
exit 2