Sign inSign up

jcmoraisjr/whoami

By jcmoraisjr

Updated about 8 years ago

Echo the hostname

Image
0

10K+

jcmoraisjr/whoami repository overview

Small Go app that shows the container's hostname in response of requests on port :8000. Useful on load balancing tests.

Code (git repo coming soon)

package main

import (
	"io"
	"net/http"
	"os"
)

func main() {
	hostName, err := os.Hostname()
	if err != nil {
		hostName = "<fail>"
	}
	http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
		io.WriteString(w, hostName+"\n")
	})
	http.ListenAndServe(":8000", nil)
}

Tag summary

Content type

Image

Digest

Size

1.5 MB

Last updated

about 8 years ago

docker pull jcmoraisjr/whoami