For enterprise customers the CLI offers the possibility of running your Mock APIs locally, removing the need to have a connection to the internet.

Getting Access

Contact the WireMock team to request a license file, which should be placed in the appropriate configuration location for your operating system:

  • Windows: %LOCALAPPDATA%\wiremock-cli (typically C:\Users\{username}\AppData\Local\wiremock-cli)
  • macOs: /Users/{username}/.config/wiremock-cli
  • Linux: $XDG_CONFIG_HOME/wiremock-cli (typically /home/{username}/.config/wiremock-cli)

Usage

First you will need to pull one or more of your Mock APIs locally:

wiremock pull mock-api <mock-api-id>

This will create a .wiremock directory in the current working dir, and populate it with the necessary files to be able to run the identified Mock API.

You can pass a --wiremock-dir argument to override the default .wiremock directory.

You can do this repeatedly to pull down multiple Mock APIs, or pass the --all flag to pull down all Mock APIs to which you have access.

You can then run the Mock API as so:

wiremock run

This will run all the Mock APIs you have pulled down into the .wiremock directory. A table will be printed showing you which port is being used for which API.

(Naturally you can pass the same --wiremock-dir argument to override the default .wiremock directory.)

Running in a Container

The CLI is published to Docker Hub as wiremock/wiremock-cli. By default, it executes the run command, but in order for the run command to be able to operate you must mount your config directory to /etc/wiremock-cli and the working directory containing your mock APIs to /work.

You will also need to publish the appropriate ports for the services you are running.

Here is a typical example on Linux or macOs when running two Mock APIs:

docker run \
  -v ~/.config/wiremock-cli:/etc/wiremock-cli \
  -v $(pwd):/work \
  -p 8080:8080 \
  -p 8081:8081 \
  wiremock/wiremock-cli:latest