Mocking with mock-server

When you want to expose another port than 80 from the mock-server you need to change the serverPort. The Docker port mapping does not work in this case, which is strange

This works:

service-mock:
  image: jamesdbloom/mockserver:5.3.0
  ports:
    - "82"
  entrypoint: /opt/mockserver/run_mockserver.sh -logLevel TRACE -serverPort 82
  networks:
    test_net:
      aliases:
        - service-mock

This does not work:

service-mock:
  image: jamesdbloom/mockserver:5.3.0
  ports:
    - "82:80"
  entrypoint: /opt/mockserver/run_mockserver.sh -logLevel TRACE -serverPort 80
  networks:
    test_net:
      aliases:
        - service-mock

Furthermore, when mocking request and it is unclear why a request does not match an expectation merely turn on TRACE logging for the mockserver. It explains in details why it did not match.

© 2021