Skip to content

Get status of a container over HTTP. Helps in running monitors for docker containers.

License

Notifications You must be signed in to change notification settings

hibare/go-container-status

Repository files navigation

go-container-status

Go Report Card Docker Hub Docker image size GitHub issues GitHub pull requests GitHub GitHub release (latest by date)

A REST API designed in go to check for a container status

Getting Started

go-container-status is packaged as docker container. Docker image is available on Docker Hub.

Docker run

docker run -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock -e LISTEN_ADDR='0.0.0.0' go-container-status

Docker Compose

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"

Endpoints

  1. Check health
/ping/
  1. 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

Supported Environment Variables

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

About

Get status of a container over HTTP. Helps in running monitors for docker containers.

Topics

Resources

License

Stars

Watchers

Forks

Packages