No description, website, or topics provided.
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
Dockerfile
LICENSE
README.md
gurl.go
gurl_test.go

README.md

Build Status Coverage Status Go Report Card

GURL

A simple replacement for curl when you want to use it as a docker HEALTHCHECK instruction.

Usage

In your Dockerfile add a HEALTHCHECK line with

HEALTHCHECK --interval=5m --timeout=3s CMD /gurl http://localhost:8080/

Now you can use docker ps to see the health of the container

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                   PORTS                    NAMES
e1b2d3559cc3        gurl                "/server"                2 minutes ago       Up 2 minutes (healthy)                            romantic_leakey

If you want to check the output from the health check, use:

docker inspect --format='{{json .State.Health}}' <container name> | jq
{
  "Status": "healthy",
  "FailingStreak": 0,
  "Log": [
    {
      "Start": "2017-01-24T03:31:38.301163386Z",
      "End": "2017-01-24T03:31:38.383919716Z",
      "ExitCode": 0,
      "Output": "alive\n"
    },
    {
      "Start": "2017-01-24T03:31:53.385446984Z",
      "End": "2017-01-24T03:31:53.469891391Z",
      "ExitCode": 0,
      "Output": "alive\n"
    }
  ]
}