Search code examples
dockerdocker-composewiremock

Adding wiremock extension in docker-compose


I am using docker-compose in my project and spinning up the rodolpheche/wiremock image like below

  wiremock:
image: rodolpheche/wiremock
ports:
  - "xxxx:xxxxx"
volumes:
  - ./src/wiremock:/home/wiremock

Now I want to add some random body transformer extension to the above wiremock image. extension path is = org.m.BodyRandomizer

I have seen the docker page(https://hub.docker.com/r/rodolpheche/wiremock/) regarding adding an extension but I could not get much.


Solution

  • You will need to add an additional volume mount to /var/wiremock/extensions to which you bind your local folder which contains the extension you want to add. In addition to that you will have to specify a command option in your compose to execute the call --extensions com.opentable.extension.BodyTransformer.

    This will result in something like this:

    wiremock:
        image: rodolpheche/wiremock
        ports:
          - "xxxx:xxxxx"
        command: --extensions com.opentable.extension.BodyTransformer
        volumes:
          - ./src/wiremock:/home/wiremock
          - ./extension_dir:/var/wiremock/extensions
    

    I hope this helps you