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)
MIT License
22 stars 6 forks source link

Persist mappings? #36

Closed mattisking closed 1 year ago

mattisking commented 2 years ago

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

mattisking commented 2 years ago

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.

StefH commented 2 years ago

@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.