WireMock-Net / WireMock.Net-docker

WireMock.Net-docker is a Docker image which runs WireMock.Net (a flexible library for stubbing and mocking web services)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persist mappings?

mattisking opened this issue · comments

How might I run the docker command(s) in such a way as to persist the mappings when I restart the container?

So here's what I came up with FWIW without using docker compose:
docker run -it --name wiremock-net -p 9091:80 -v $PWD/wiremock-net/mappings:/app/__admin/mappings sheyenrath/wiremock.net -c dotnet wiremock-net.dll --Urls http://*:80 --ReadStaticMappings true --WireMockLogger WireMockConsoleLogger

That creates the mappings folder in a volume and launches wiremock with ReadStaticMappings enabled.
docker cp .\bl-Default.json wiremock-net:/app/__admin/mappings/bl-Default.json

Restarted the container and I'm good. I suppose I could also include the WatchStaticMappings flag and skip the restart.

@mattisking
There is a wiki page that describes how to use docker compose:
https://github.com/WireMock-Net/WireMock.Net-docker/wiki/Docker-Compose

But if your solution also works, that's great! I'll also add that to the wiki.