Skip to main content
MockServer supports multiple deployment options. Choose the one that fits your environment.
All deployment options (except the deployable WAR) use a single port for HTTP, HTTPS, and SOCKS traffic via port unification. You do not need to configure separate ports for different protocols.
Run MockServer as a Docker container:
docker run -d --rm -p 1080:1080 mockserver/mockserver
MockServer is now available at http://localhost:1080.Configure via environment variablesPass configuration options as environment variables:
docker run -d --rm \
  -p 1090:1090 \
  --env MOCKSERVER_LOG_LEVEL=TRACE \
  --env MOCKSERVER_SERVER_PORT=1090 \
  mockserver/mockserver
Docker ComposeAdd MockServer as a service in your docker-compose.yml:
version: "2.4"
services:
  mockServer:
    image: mockserver/mockserver:5.15.0
    ports:
      - 1080:1080
    environment:
      MOCKSERVER_MAX_EXPECTATIONS: 100
      MOCKSERVER_MAX_HEADER_SIZE: 8192
To mount a properties file or JSON expectation initializer:
version: "2.4"
services:
  mockServer:
    image: mockserver/mockserver:5.15.0
    ports:
      - 1080:1080
    environment:
      MOCKSERVER_PROPERTY_FILE: /config/mockserver.properties
      MOCKSERVER_INITIALIZATION_JSON_PATH: /config/initializerJson.json
    volumes:
      - type: bind
        source: .
        target: /config
MockServer uses a distroless base image (no interactive shell) for reduced attack surface. Only the JVM and MockServer code are included in the container.