Sign inSign up

amitbahree/hello-world

By amitbahree

•Updated almost 2 years ago

Hello World web server in under 5 MB

Image
Web servers
1

10K+

amitbahree/hello-world repository overview

⁠Hello World

This is a simple Docker image that just gives HTTP responses on a configurable port. It's small enough (~4.2 mb) to fit on one floppy disk 💾!

$ docker images | grep hello-world
REPOSITORY                      TAG       IMAGE ID        CREATED        VIRTUAL SIZE
amitbahree/hello-world          latest    de265d51837e    5 hours ago    4.28MB

Question: What is a floppy disk? 🤔

There is often a scenario where you neeed a simple web server to test things out and make sure everything is wired up OK. This image is a simple web server that listens on port 8000 and returns a simple HTML page and shows some server details. It is based on the Busybox.

You can get more details on the GitHub repo⁠.

⁠Sample Usage

⁠Starting a web server on port 9999
$ docker run -d --rm -p 9999:8000 amitbahree/hello-world

The image below shows an example of what this would look like.

Hello World

If the page renders, and you see the server details, then you are good to go. If you don't see the page, then you might have a firewall issue or the port is already in use, or some problem with the Docker daemon.

I often use this image to test out things like Kubernetes, Docker, Firewalls, and other things where I need a simple web server to test things out.

You can also interact with this and browse to is using a browser or use curl to interact with it as shown below:

$ curl http://localhost:9999/cgi-bin/serverinfo.sh

In the console, you should see something similar to the detail below.

Server Information:
-------------------
Hostname: 6cdfa2a2bfff
IP Address: RETRACTED
Date and Time: Fri Dec  6 01:40:49 UTC 2024
Uptime:  01:40:49 up 8 days,  6:32,  0 users,  load average: 0.00, 0.04, 0.00
Server Details: Linux 6cdfa2a2bfff 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 GNU/Linux
CPU Usage: Unavailable
Memory Usage: 5.94%
Disk Usage: 3%
Network Interfaces: 172.17.0.2,127.0.0.1
Container ID: 6cdfa2a2bfff2187ab14af7da9ac2763d0d074e0023beb040f7b7b097bd6514f
⁠Building and Publishing to GitHub Registry

To build and publish the image to GitHub Container Registry:

# Build the Docker image
$ docker build -t amitbahree/hello-world .

# Log in to GitHub Container Registry
$ echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin

# Tag the image
$ docker tag amitbahree/hello-world ghcr.io/amitbahree/hello-world:latest

# Push the image
$ docker push ghcr.io/amitbahree/hello-world:latest

Tag summary

Content type

Image

Digest

sha256:6206301b8…

Size

2.1 MB

Last updated

almost 2 years ago

docker pull amitbahree/hello-world