A REST API designed in go to check for a container status
go-container-status is packaged as docker container. Docker image is available on Docker Hub.
docker run -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock -e LISTEN_ADDR='0.0.0.0' go-container-status
version: "3"
services:
go-container-status:
image: hibare/go-container-status
container_name: go-container-status
hostname: go-container-status
environment:
- LISTEN_ADDR=0.0.0.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "5000:5000"
logging:
driver: "json-file"
options:
max-size: "500k"
max-file: "5"
- Check health
/ping/
- Check a container status
/container/{container_name}/status/
Example:
> curl -H "Authorization: test" http://127.0.0.1:5000/container/postgres/status/
[{"Name":["/postgres"],"State":"exited","Status":"Exited (0) 2 hours ago","Image":"postgres:latest"}]
> curl -H "Authorization: test" http://127.0.0.1:5000/container/postgrsaes/status/
Not found
Variable | Description | Default Value |
---|---|---|
LISTEN_ADDR | IP address to bind to | 127.0.0.1 |
LISTEN_PORT | Port to bind to | 5000 |
API_KEYS | API Keys used for auth | Autogenerated |