A simple echoserver written in Go
8.4K
A tiny, single-binary HTTP echo server written in Go. Send it a request on any path and it replies with the request's metadata, headers, host, and body — handy for inspecting what a client, proxy, ingress, or load balancer actually sends.
key = value, and anything else is echoed verbatim.413),
read/header timeouts bound slow clients, and shutdown drains in-flight requests.distroless/static:nonroot, multi-arch
(linux/amd64, linux/arm64), and only a few MB in size.latest — the most recent release.vX (e.g. v1) — the latest release of a major version.vX.Y.Z (e.g. v1.7.3) — a specific immutable release. Pin this in production.Pull a tag with docker pull houstonj1/echoserver:<tag>.
docker run --rm -p 3000:3000 houstonj1/echoserver
Then send it a request:
curl -X POST 'http://localhost:3000/api/test?debug=true' \
-H 'Content-Type: application/json' \
-d '{"hello":"world","n":42}'
Response:
Request Information:
Client Address: 172.17.0.1:54895
Method: POST
Path: /api/test
Protocol: HTTP/1.1
Query Parameters: debug=true
Request Headers:
Accept: */*
Content-Length: 24
Content-Type: application/json
User-Agent: curl/8.7.1
Host: localhost
Request Body:
{
"hello": "world",
"n": 42
}
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | TCP port to listen on. Must be an integer in the range 1–65535. |
docker run --rm -e PORT=8080 -p 8080:8080 houstonj1/echoserver
kubectl create namespace echoserver
kubectl create deployment echoserver \
--image houstonj1/echoserver \
--port 3000 \
--replicas 2 \
-n echoserver
kubectl expose deployment echoserver -n echoserver
kubectl port-forward svc/echoserver 3000:3000 -n echoserver
For a production-ready setup, apply a manifest with resource limits, readiness and liveness probes, and a hardened security context:
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
labels:
app: echoserver
spec:
replicas: 2
selector:
matchLabels:
app: echoserver
template:
metadata:
labels:
app: echoserver
spec:
containers:
- name: echoserver
image: houstonj1/echoserver
ports:
- containerPort: 3000
resources:
requests:
cpu: 10m
memory: 16Mi
limits:
memory: 32Mi
readinessProbe:
tcpSocket:
port: 3000
initialDelaySeconds: 1
livenessProbe:
tcpSocket:
port: 3000
initialDelaySeconds: 5
securityContext:
runAsNonRoot: true
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
---
apiVersion: v1
kind: Service
metadata:
name: echoserver
labels:
app: echoserver
spec:
selector:
app: echoserver
ports:
- name: http
port: 80
targetPort: 3000
Content type
Image
Digest
sha256:f6e29f86c…
Size
3.3 MB
Last updated
14 days ago
docker pull houstonj1/echoserver