Docker
The mokksy/server-jvm image runs Mokksy as a standalone HTTP mock server. Stubs are loaded from a YAML file at startup, before the server begins accepting connections.
Quick start
Create a stubs file:
1stubs:
2 - name: ping
3 method: GET
4 path: /ping
5 response:
6 body: '{"response":"Pong"}'
7 status: 200
Start the container, mounting the file to the default config path:
1docker run -p 8080:8080 \
2 -v ./stubs.yaml:/config/stubs.yaml \
3 mokksy/server-jvm:snapshot
The image sets MOKKSY_CONFIG=/config/stubs.yaml by default, so mounting the file there requires no extra environment variables.
Docker Compose
1services:
2 mokksy:
3 image: mokksy/server-jvm
4 ports:
5 - "8080:8080"
6 volumes:
7 - ./stubs.yaml:/config/stubs.yaml
To use a different path, override MOKKSY_CONFIG:
1services:
2 mokksy:
3 image: mokksy/server-jvm
4 ports:
5 - "8080:8080"
6 volumes:
7 - ./stubs.yaml:/app/stubs.yaml
8 environment:
9 MOKKSY_CONFIG: /app/stubs.yaml
Environment variables
| Variable | Default | Description |
|---|---|---|
MOKKSY_CONFIG | /config/stubs.yaml | Path to the YAML stubs file inside the container |
JAVA_OPTS | -XX:MaxRAMPercentage=75 -XX:+ExitOnOutOfMemoryError | JVM flags passed to the server process |
Startup behaviour
Stubs are loaded from MOKKSY_CONFIG before the server binds its port. Every request is matchable from the first connection — there is no window where a request can arrive before stubs are registered.
If MOKKSY_CONFIG is unset or the file is absent, the server starts with an empty stub registry and returns 404 for all requests.
Stubs file format
See File-based configuration for the full YAML schema, supported response types, and matching options.