/docker-hello-world

A Hello World service with Prometheus instrumentation

Primary LanguageGoApache License 2.0Apache-2.0

GHCR Build Status Docker Hub Build Status

ghcr.io/infrastructure-as-code/hello-world

A Prometheus-instrumented Docker "Hello World" web server. This image began life as infrastructureascode/hello-world on Docker Hub, and is now also available on the GitHub Container Registry as ghcr.io/infrastructure-as-code/hello-world.

Images

Registry Name Image Name
GitHub Container Registry ghcr.io/infrastructure-as-code/hello-world
Docker Hub infrastructureascode/hello-world

Features

  1. Always returns a HTTP 200 status code and a "Hello, World!" message at the / path.
  2. Has a metrics endpoint at /metrics that returns Prometheus metrics.
  3. Has a health check endpoint, /health, that returns an empty response and a HTTP 200 response.

Building

docker build --rm -t ghcr.io/infrastructure-as-code/hello-world .

Releases

Images are built with GitHub Actions upon tagging/push, and pushed directly to the GitHub Container Registry. You can look at the packages page for the latest tagged version.

Additionally, the sha1sum of the binary in each image is emitted during the build process (look for "Show binary info") in the build logs in case provenance is a concern.

Usage

# start the container
docker run \
  --detach \
  --name hello-world \
  --publish 8000:8080 \
  ghcr.io/infrastructure-as-code/hello-world

# curl the container
curl http://0.0.0.0:8000/

# curl the health check endpoint which returns an empty response
curl http://0.0.0.0:8000/health

# curl Prometheus metrics
curl http://0.0.0.0:8000/metrics