Sign inSign up

gkoenig/simplehttp

By gkoenig

•Updated over 6 years ago

simple http server in golang

Image
16

1M+

gkoenig/simplehttp repository overview

⁠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
⁠usage

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 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

Tag summary

Content type

Image

Digest

Size

3.7 MB

Last updated

over 6 years ago

docker pull gkoenig/simplehttp