In a previous article, we explored how to start a WireMock server within a test context. However, if you want to extend your testing to include manual or integration scenarios, you may prefer to run the mock server independently.
In this article, we’ll walk through how to launch WireMock as a standalone server, allowing it to serve mock responses continuously — even outside automated test environments.
There are two main ways to run WireMock as a standalone service:
- Via Docker
- Via JAR
In this article, we’ll focus on the first option: running WireMock as a standalone service using Docker.
📌 Prerequisites
To run Docker containers on your local machine, make sure you have Docker Desktop installed and running.
✅ Step 1: Run WireMock Docker Container
Pull & Run WireMock:
docker run -d \
--name wiremock \
-p 9561:8080 \
-v "$PWD/wiremock:/home/wiremock" \
wiremock/wiremock:3.3.1
This.
- Exposes WireMock on port 9561
- Mounts your local ./wiremock folder to /home/wiremock in the container for mapping files and stubs
✅ Step 2: Create Local WireMock Folder Structure
By default, WireMock expects the following folder structure. If they are not created automatically, you should create them manually:
/home/wiremock/
├── mappings/
│ └── your-mapping.json
└── __files/
└── your-response.json
✅ Step 3: Define a Stub Mapping with Matchers
📄 File: wiremock/mappings/get-pet-by-id.json
{
"request": {
"method": "GET",
"urlPattern": "/pet/([0-9]+)"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "mock-pet-response.json"
}
}
🔹 urlPattern allows flexible matching like /pet/1, 2, etc./pet/1
📄 File: wiremock/__files/mock-pet-response.json
{
"id": 1,
"category": {
"id": 1,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 1,
"name": "string"
}
],
"status": "available"
}✅ Step 4: Verify
Hit : http://localhost:9561/pet/1, and you would get

✍️ NOTE
Make sure Docker is running and your stub files are properly mounted.
If you started the Docker container before adding the files, stop (kill) the container and re-run it to ensure the files are loaded correctly.
Some Useful Bash Commands for Managing WireMock with Docker
- Remove Docker
docker rm -f wiremock- Check Logs in WireMock Docker Container
docker logs wiremock
