All Projects → aelsabbahy → Goss Docker

aelsabbahy / Goss Docker

Easy docker health checks, /healthz endpoints, and container delays

Goss Docker container

Dockerfiles

Goss

Not sure what Goss is, read these:

  • Goss - Project page
  • Blog post - Examples on how these Goss images can be used

Using the base image

This is a simple alpine image with Goss preinstalled on it. Can be used as a base image for your projects to allow for easy health checking.

Mount example

Create the container

docker run --name goss aelsabbahy/goss goss

Create your container and mount goss

docker run --rm -it --volumes-from goss --name weby nginx

Run goss inside your container

docker exec weby /goss/goss autoadd nginx

HEALTHCHECK example

FROM aelsabbahy/goss:latest

COPY goss/ /goss/
HEALTHCHECK --interval=1s --timeout=6s CMD goss -g /goss/goss.yaml validate

# your stuff..

Startup delay example

FROM aelsabbahy/goss:latest

COPY goss/ /goss/

# Alternatively, the -r option can be set
# using the GOSS_RETRY_TIMEOUT env variable
CMD goss -g /goss/goss.yaml validate -r 5m && exec real_comand..

Using the onbuild image

Create a goss/goss.yaml file and optionally a checks folder in the following structure:

.
|-- Dockerfile
`-- goss/
    |-- checks/
    |   `-- db_login.sh
    `-- goss.yaml

In your Dockerfile use the onbuild container as follows:

Serve a healthz endpoint

FROM aelsabbahy/goss:onbuild
CMD ["serve"]

Run tests until they pass or we timeout

FROM aelsabbahy/goss:onbuild
CMD ["validate", "--retry-timeout", "5m", "--sleep", "10s"]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].