Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aelsabbahy/goss-docker
Easy docker health checks, /healthz endpoints, and container delays
https://github.com/aelsabbahy/goss-docker
Last synced: 2 months ago
JSON representation
Easy docker health checks, /healthz endpoints, and container delays
- Host: GitHub
- URL: https://github.com/aelsabbahy/goss-docker
- Owner: aelsabbahy
- License: apache-2.0
- Created: 2016-08-02T02:48:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-03T17:12:46.000Z (over 1 year ago)
- Last Synced: 2024-07-10T09:54:46.856Z (3 months ago)
- Language: Dockerfile
- Homepage:
- Size: 19.5 KB
- Stars: 27
- Watchers: 6
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Goss Docker container
## Dockerfiles
* [latest](https://github.com/aelsabbahy/goss-docker/blob/master/Dockerfile)
* [onbuild](https://github.com/aelsabbahy/goss-docker/blob/master/onbuild/Dockerfile)## Goss
Not sure what Goss is, read these:* [Goss](https://github.com/aelsabbahy/goss) - Project page
* [Blog post](https://medium.com/@aelsabbahy/docker-1-12-kubernetes-simplified-health-checks-and-container-ordering-with-goss-fa8debbe676c) - 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:latestCOPY goss/ /goss/
HEALTHCHECK --interval=1s --timeout=6s CMD goss -g /goss/goss.yaml validate# your stuff..
```### Startup delay example
```
FROM aelsabbahy/goss:latestCOPY 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"]
```