A minimal Rust webserver that returns OK and status 200
2.6K
A minimal Rust webserver that responds with OK on HTTP request. It's designed to be a tiny, zero-dependency binary that listens on a configurable port.
docker run -d -p 8080:8080 gnarr/ok
curl http://localhost:8080
# OK
| Variable | Description | Default |
|---|---|---|
| PORT | TCP port the server binds to | 8080 |
| SHOW_FAVICON | Whether to serve /favicon.ico (set to "false" to disable it) | true (any value other than "false" enables it) |
| THREAD_POOL_SIZE | Number of worker threads to spawn (falls back to CPU count or 4) | CPU core count (via available_parallelism) or 4 if unknown |
# pull from Docker Hub
docker pull gnarr/ok:latest
# Run container:
docker run -d -p 8080:8080 \
-e PORT=8080 \
gnarr/ok:latest
# Compile in release mode
cargo build --release
# Run the server (default port 8080)
./target/release/ok
# Or specify a port:
PORT=9000 ./target/release/ok
Verify:
curl http://localhost:8080
# Should return 'OK' with HTTP 200
Create a docker-compose.yml in your project root:
services:
ok-server:
image: gnarr/ok:latest
ports:
- "8080:8080"
environment:
PORT: 8080
Run:
docker-compose up -d
Then curl http://localhost:8080 to see OK.
Content type
Image
Digest
sha256:694222f6b…
Size
10.4 MB
Last updated
5 months ago
docker pull gnarr/ok