Not sure what Goss is, read these:
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.
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
FROM aelsabbahy/goss:latest
COPY goss/ /goss/
HEALTHCHECK --interval=1s --timeout=6s CMD goss -g /goss/goss.yaml validate
# your stuff..
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..
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:
FROM aelsabbahy/goss:onbuild
CMD ["serve"]
FROM aelsabbahy/goss:onbuild
CMD ["validate", "--retry-timeout", "5m", "--sleep", "10s"]