The goal of this project is to be the smallest possible Docker image for testing HTTP services. The server responds to all HTTP requests with a simple "Hello, World!" As of v0.5.0, the Docker container is just 23kB.
Sometimes I want to test my backend setup: a reverse proxy, some port forwarding, my docker-compose configuration, etc. In such cases, I want the most simple HTTP service possible. This is it.
To run this with Docker, do something like
docker run \
-e HOST=0.0.0.0 -e PORT=8000 \
-p 8000:8000 --init \
ghcr.io/kljensen/hello-world-http:latestNotice:
HOSTandPORTare required.HOSTmust be in dotted decimal, like0.0.0.0- If
HOSTis something other than0.0.0.0, your container will likely not respond to external requests. PORTis the port on which the server will listen inside the container. If you're forwarding from the host to the container, obviously this needs to match the port you publish with-p. See the Docker documentation.- The
--initflag is optional, but it's a good idea to use it. It ensures that the server process is stopped properly when Docker gets aSIGTERMsignal. (For example, this will makedocker runhandleCtrl-Cproperly.)
To run this with Docker Compose, you should have a
docker-compose.yml file that looks something like
services:
hello-world:
image: ghcr.io/kljensen/hello-world-http:latest
init: true
ports:
- "8000:8000"
environment:
- HOST=0.0.0.0
- PORT=8000Then you can run it with
docker-compose upCheck out the packages and tags.
This is licensed under the Unlicense. Do whatever you want with it!