mockserver
MockServer enables easy mocking or proxying of any system you integrate with via HTTP or HTTPS
100M+
MockServer is an HTTP(S) mock server and proxy for testing. Mock the APIs your application depends on, so you can develop and test against systems that are unavailable, incomplete, or hard to reproduce. Proxy real traffic to record, inspect, and modify requests and responses in flight, pausing them at interactive proxy breakpoints to step through, edit, or abort each exchange like a debugger for network traffic. And with built-in chaos engineering, make dependencies misbehave on demand — injecting latency, dropped connections, and errors — to test how your application copes when the systems it relies on degrade or fail.
Speaks every protocol your stack uses. HTTP/1.1 & HTTPS, HTTP/2, gRPC & gRPC-Web, WebSockets and raw TCP are auto-detected from the first bytes of each connection, so one MockServer port handles them all with no per-protocol configuration. Beyond that core: HTTP/3 (QUIC — experimental, on its own UDP port), JSON-RPC for MCP/A2A mocking, AsyncAPI-driven message-broker testing against external Kafka and MQTT brokers, and mocked AI/LLM chat-completion APIs (OpenAI, Anthropic, Gemini, Bedrock, Azure OpenAI, Ollama).
/mockserver/dashboard.docker run -d --rm --name mockserver -p 1080:1080 mockserver/mockserver
http://localhost:1080http://localhost:1080/mockserver/dashboardStop it with docker stop mockserver.
The same software is published as several image variants, distinguished by tag prefix/suffix. For most users the default image is correct.
| Tag pattern (examples) | Variant | Use it when |
|---|---|---|
latest, 7.3.0 | Default — distroless, runs as non-root. Smallest and most secure; no shell. | The normal choice for almost everyone. |
latest-graaljs, 7.3.0-graaljs | GraalJS — adds the GraalVM JavaScript engine. | You use JavaScript response/forward templates (the default image only supports Velocity/Mustache + JS-free use). |
clustered-latest, clustered-7.3.0 | Clustered — bundles the Infinispan state backend (JGroups). | You run multiple MockServer instances that must share expectations/state (MOCKSERVER_STATE_BACKEND=infinispan). |
root, root-snapshot | Root — same as default/snapshot but runs as root. | A platform requires the container to run as root (most don't). |
snapshot, snapshot-graaljs, mockserver-snapshot | Snapshot — built from the latest master. | You want the bleeding-edge unreleased build (not for production). |
A separate image, mockserver/mockserver-webhook, is the Kubernetes admission webhook that auto-injects a MockServer proxy sidecar — see the service-mesh docs.
Every released version is available under two equivalent tag forms — pick whichever you prefer:
mockserver/mockserver:7.3.0mockserver- prefixed: mockserver/mockserver:mockserver-7.3.0latest always points at the most recent release of the default variant. Pin to an explicit version (e.g. 7.3.0) in production; latest/snapshot are moving tags.
Images are published to Docker Hub and mirrored to AWS ECR Public:
docker pull mockserver/mockserver:7.3.0
docker pull public.ecr.aws/t2x9c0i6/mockserver:7.3.0
docker run --rm --name mockserver -p 1080:1080 mockserver/mockserver
The server listens on 1080 inside the container; map it to any host port:
docker run -d --rm --name mockserver -p 9090:1080 mockserver/mockserver
The default command is -logLevel INFO -serverPort 1080. Append your own to override — for example, run as a port-forwarding proxy:
docker run --rm --name mockserver -p 1090:1090 mockserver/mockserver \
-logLevel INFO -serverPort 1090 -proxyRemotePort 443 -proxyRemoteHost www.mock-server.com
Any configuration property can be set as an env var (MOCKSERVER_ prefix, upper-snake-case):
docker run -d --rm --name mockserver -p 1080:1080 \
-e MOCKSERVER_MAX_EXPECTATIONS=200 \
-e MOCKSERVER_LOG_LEVEL=WARN \
mockserver/mockserver
services:
mockServer:
image: mockserver/mockserver:7.3.0
ports:
- 1080:1080
environment:
- MOCKSERVER_MAX_EXPECTATIONS=100
- MOCKSERVER_MAX_HEADER_SIZE=8192
The container reads /config/mockserver.properties and extra classpath jars from /libs:
docker run -d --rm --name mockserver -p 1080:1080 \
-v "$(pwd)/config:/config" \
mockserver/mockserver
Point mockserver.properties at an initialization JSON to pre-load expectations on startup — see initializing expectations.
Release images are signed with cosign using MockServer's signing key, published at https://www.mock-server.com/mockserver-cosign.pub:
cosign verify \
--key https://www.mock-server.com/mockserver-cosign.pub \
mockserver/mockserver:7.3.0
The same key signs every image variant (-graaljs, clustered-…), the ECR Public mirror, and the Helm chart.
Full documentation, client libraries (Java, JavaScript, Python, Ruby), the Helm chart, and examples are at www.mock-server.com. Report issues on GitHub.
Content type
Image
Digest
sha256:d03356d2c…
Size
164.8 MB
Last updated
about 10 hours ago
docker pull mockserver/mockserver:mockserver-snapshot-graaljs