Simple HTTP server written in golang
Simple webserver in golang, to demonstrate basic functionalities like e.g. sending back some request header info, the local IP address of the container and how to include the usage of environment variables.
what does it do?
This container starts a webserver on port 8000 and returns back
- some header information
- the local ip address of the container
- the message provided by environment variable called message
to start simplehttp web server , map local port 8000 into container and provide the env variable message:
sudo docker run -e message=Hello -p 8000:8000 gkoenig/simplehttp
output from above call (your IP address will vary):
GET / HTTP/1.1 Header["User-Agent"] = ["curl/7.58.0"] Header["Accept"] = ["*/*"] Host = "localhost:8000" RemoteAddr = "172.17.0.1:36540" ===> local IP: "172.17.0.2" Env message = Hello