Installation


Mockoon Pro is distributed as an official Docker image on Docker Hub (mockoon/pro). It requires a persistent storage directory and a base domain name.

 Prerequisites

  • Docker or OCI container engine (Docker Engine, Podman, containerd).
  • Persistent storage volume: A local or network persistent volume (minimum 1GB recommended) mounted to /data.
  • Domain & DNS records:
    • A base domain pointing to your server (e.g. mockoon.company.com, replace with your own domain).
    • A wildcard DNS record (*.mockoon.company.com) if using subdomain routing (default). Not required for path-based routing (https://mockoon.company.com/mocks/{subdomain}).
  • TLS Certificate (for production): A wildcard certificate covering mockoon.company.com and *.mockoon.company.com for subdomain routing, or a standard single-domain certificate for path-based routing.

 Deployment methods

The official image runs in production mode and listens on container port 5020. These defaults are already configured inside the image.

 Docker

You can run Mockoon Pro with a standard docker run command:

Copy
docker run -d \ --name mockoon-pro \ --stop-timeout 30 \ -p 5020:5020 \ -e MOCKOON_DOMAIN=mockoon.company.com \ -e MOCKOON_SERVER_ID=mockoon-node-1 \ -v mockoon-data:/data \ mockoon/pro:latest

 Docker Compose

For VM and standalone server deployments, Docker Compose paired with a reverse proxy like Caddy provides a complete, turnkey stack with automated HTTPS certificate provisioning for both your base domain and dynamic mock subdomains.

 Docker Compose with Caddy (Automated HTTPS)

This setup uses Caddy with On-Demand TLS. Caddy automatically provisions and renews TLS certificates via Let's Encrypt / ZeroSSL on port 80 for the main dashboard and every mock subdomain created by your team, with zero DNS API credentials required.

  1. Create a docker-compose.yml file:
Copy
services: caddy: image: caddy:2-alpine container_name: mockoon-proxy restart: unless-stopped ports: - '80:80' - '443:443' volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config depends_on: - mockoon-pro mockoon-pro: image: mockoon/pro:latest container_name: mockoon-pro restart: unless-stopped stop_grace_period: 30s environment: - MOCKOON_DOMAIN=mockoon.company.com - MOCKOON_SERVER_ID=mockoon-pro-prod - MOCKOON_STORAGE_DIR=/data/ - USE_HTTPS=true volumes: - mockoon-pro-data:/data volumes: caddy_data: caddy_config: mockoon-pro-data:
  1. Create a Caddyfile in the same directory:
Copy
{ on_demand_tls { # Internal permission check to prevent certificate issuance abuse ask http://127.0.0.1:8080/check-domain } } # Internal check endpoint to validate subdomains :8080 { @allowed `{query.domain}.endsWith('.mockoon.company.com') || {query.domain} == 'mockoon.company.com'` respond @allowed 200 respond 400 } # Main dashboard & API https://mockoon.company.com { reverse_proxy mockoon-pro:5020 } # Dynamic mock subdomains (On-demand TLS) https://*.mockoon.company.com { tls { on_demand } @subdomains host *.mockoon.company.com handle @subdomains { reverse_proxy mockoon-pro:5020 } }

 Standalone Docker Compose (No Reverse Proxy)

If you already terminate TLS at an external load balancer or firewall:

Copy
services: mockoon-pro: image: mockoon/pro:latest container_name: mockoon-pro restart: unless-stopped stop_grace_period: 30s ports: - '5020:5020' environment: - MOCKOON_DOMAIN=mockoon.company.com - MOCKOON_SERVER_ID=mockoon-pro-prod - MOCKOON_STORAGE_DIR=/data/ volumes: - mockoon-pro-data:/data volumes: mockoon-pro-data:

 Kubernetes & OpenShift

Mockoon Pro is compatible with Kubernetes and OpenShift environments:

  • Volume permissions: The container is pre-configured with root group (GID 0) permissions (chgrp 0 /data && chmod g+rwX /data) to seamlessly support OpenShift's arbitrary non-root UID security context constraints (SCC).
  • Persistent Volume Claim: Mount a ReadWriteOnce (RWO) PVC to /data.
  • Ingress / Route: Route the main domain (mockoon.company.com)—and wildcard subdomains (*.mockoon.company.com) if using subdomain routing—to container port 5020.
Copy
apiVersion: apps/v1 kind: Deployment metadata: name: mockoon-pro spec: replicas: 1 strategy: type: Recreate # SQLite on an RWO volume: never run two pods at once selector: matchLabels: app: mockoon-pro template: metadata: labels: app: mockoon-pro spec: terminationGracePeriodSeconds: 30 containers: - name: mockoon-pro image: mockoon/pro:latest ports: - containerPort: 5020 env: - name: MOCKOON_DOMAIN value: 'mockoon.company.com' - name: MOCKOON_SERVER_ID value: 'mockoon-k8s-1' - name: MOCKOON_STORAGE_DIR value: '/data/' volumeMounts: - name: mockoon-storage mountPath: /data volumes: - name: mockoon-storage persistentVolumeClaim: claimName: mockoon-pro-data-pvc

 Graceful shutdown

Allow 30 seconds for shutdowns, restarts, and updates so Mockoon Pro can persist pending changes.

  • Docker: Use --stop-timeout 30 when creating the container, or docker stop -t 30 mockoon-pro for an existing container.
  • Docker Compose: Set stop_grace_period: 30s on the Pro service. Apply changes with docker compose up -d.
  • Kubernetes / OpenShift: The default termination grace period is already 30 seconds. Keep this default or set terminationGracePeriodSeconds: 30 explicitly in the pod template.

Forced stops can interrupt writes and lose pending changes.

 Environment variables

The application is configured through environment variables passed to the container:

VariableRequiredDefaultDescription
MOCKOON_DOMAINOptionallocalhostBase domain for routing (e.g. mockoon.company.com). If omitted, defaults to localhost.
MOCKOON_STORAGE_DIROptional/data/Path to the directory where SQLite database files and mock environment JSON files are stored. Must be an absolute path inside the container.
MOCKOON_SERVER_IDRequiredmockoon-pro-testServer label used in logs and deployment audit metadata (lowercase letters, digits and hyphens only). This variable should not be changed after initial setup.
USE_HTTPSOptionalAuto-inferredForce true (HTTPS/WSS) or false (HTTP/WS). Automatically inferred as false for localhost and true for custom production domains. Informs the application that traffic is served over HTTPS (behind reverse proxy or Direct TLS).
MOCKOON_TLS_CERT_PATHOptionalNonePath to the server certificate/bundle when using Direct TLS. Direct TLS is only activated if this and MOCKOON_TLS_KEY_PATH are set.
MOCKOON_TLS_KEY_PATHOptionalNonePath to the server private key when using Direct TLS.
MOCKOON_TLS_CA_PATHOptionalNonePath to the CA certificate when using Direct TLS.
MOCKOON_TRUST_PROXYOptionalNoneComma-separated trusted reverse proxy IPs or CIDRs for resolving client IPs. No proxies are trusted by default. See Trusted reverse proxies.

 Trusted reverse proxies

Mockoon Pro rate-limits selected authentication and email endpoints by client IP. By default, it ignores forwarded headers and uses the IP of the direct connection. If all requests arrive through a reverse proxy or ingress, they share that proxy's rate-limit bucket unless proxy trust is configured.

Set MOCKOON_TRUST_PROXY to the IP addresses or CIDRs of proxies you control. For example, when a reverse proxy connects to Pro over loopback:

Copy
MOCKOON_TRUST_PROXY=127.0.0.1,::1

For a dedicated Docker proxy network, an example configuration is:

Copy
environment: MOCKOON_TRUST_PROXY: '172.30.0.2/32'

Replace this address with your proxy container's actual source address. Loopback is not appropriate when the proxy runs in a separate container. A dedicated proxy-only subnet may be used if container addresses change; do not include untrusted workloads in that subnet.

For Kubernetes or OpenShift, identify the ingress source addresses seen by the Pro container and trust only those addresses or a dedicated ingress subnet. Do not assume that trusting every pod or every private address is safe. Use network policies or firewall rules to restrict direct access to Pro to your ingress.

The internet-facing proxy must remove client-supplied forwarding headers and set authoritative X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto values. Additional trusted proxies must preserve the correct forwarding chain. Otherwise, clients may impersonate other IP addresses and bypass rate limits. Express also uses trusted forwarding headers to resolve the request hostname and protocol, so correct host forwarding is important for dashboard and mock routing.

Do not use true, a numeric hop count, or an all-address CIDR. Leave the variable unset when clients connect directly to Pro. Restart or recreate the container after changing it.

Proxy trust does not enable rate limiting on deployed mock requests or embedded web application assets. If multiple users behind an ingress unexpectedly receive HTTP 429 responses on authentication endpoints, check that the ingress source addresses are correctly configured.

 DNS & mock routing

Mockoon Pro serves multiple interfaces from your base domain:

  • Dashboard & API: https://mockoon.company.com
  • Embedded Web App: https://mockoon.company.com/app
  • Synchronization Gateway (WebSocket): wss://mockoon.company.com
  • Deployed Mock Instances:
    • Subdomain routing (Default): https://{subdomain}.mockoon.company.com
    • Path-based routing: https://mockoon.company.com/mocks/{subdomain}

You can choose between Subdomain routing and Path-based routing during the initial setup or at any time in Settings (/settings):

  • With Subdomain routing (Default): Configure two DNS records—an A / CNAME Record for mockoon.company.com and a Wildcard Record for *.mockoon.company.com pointing to your reverse proxy / ingress IP.
  • With Path-based routing: Only the base A / CNAME Record (mockoon.company.com) and a single standard TLS certificate / route are required. This mode is ideal when wildcard DNS or wildcard routes are restricted (for example on enterprise OpenShift or Kubernetes clusters with WildcardsNotAllowed).

 TLS options

Traffic must be served over HTTPS in production. If you use subdomain routing, your TLS setup must cover both mockoon.company.com and *.mockoon.company.com. If you use path-based routing, only mockoon.company.com needs to be covered.

Using a reverse proxy with your own certificate (a wildcard certificate for subdomain routing, or a single-domain certificate for path-based routing) is the recommended production setup:

  • Privacy: With subdomain routing, a wildcard certificate covers all dynamic mock subdomains without exposing individual subdomain names in public Certificate Transparency (CT) logs.
  • Obtain the certificate via your DNS provider, internal corporate CA, or Certbot, then mount it into your reverse proxy (omit *.mockoon.company.com if using path-based routing):

 Caddy

Copy
https://mockoon.company.com, https://*.mockoon.company.com { tls /etc/ssl/certs/fullchain.pem /etc/ssl/certs/privkey.pem reverse_proxy mockoon-pro:5020 }

Mount your certificates into the Caddy container in docker-compose.yml:

Copy
volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - ./certs:/etc/ssl/certs:ro

 Nginx

Copy
server { listen 443 ssl http2; server_name mockoon.company.com *.mockoon.company.com; ssl_certificate /etc/ssl/certs/mockoon-wildcard.crt; ssl_certificate_key /etc/ssl/private/mockoon-wildcard.key; location / { proxy_pass http://127.0.0.1:5020; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # WebSocket support for Real-time Synchronization proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }

 Option 2: Reverse proxy with On-Demand TLS (Subdomain routing)

When using subdomain routing on a standalone VM (AWS EC2, Azure VM, GCP Compute Engine, Linux VPS) without DNS-01 validation, Caddy with On-Demand TLS can issue certificates per subdomain automatically:

  • Caddy automatically requests and renews Let's Encrypt / ZeroSSL TLS certificates on port 80/443 when a new mock subdomain is accessed.
  • Requires no DNS API tokens or manual certificate renewals.

 Option 3: Cluster Ingress (Kubernetes & OpenShift)

 OpenShift Routes

If your OpenShift cluster restricts wildcard routes (WildcardsNotAllowed), select Path-based routing (https://mockoon.company.com/mocks/{subdomain}) during setup and create a single standard Route:

Copy
apiVersion: route.openshift.io/v1 kind: Route metadata: name: mockoon-pro spec: host: mockoon.company.com to: kind: Service name: mockoon-pro-service port: targetPort: 5020 tls: termination: edge

If wildcard routes are enabled (WildcardsAllowed) and you use Subdomain routing, add a second wildcard Route alongside the main route:

Copy
apiVersion: route.openshift.io/v1 kind: Route metadata: name: mockoon-wildcard spec: host: wildcard.mockoon.company.com wildcardPolicy: Subdomain to: kind: Service name: mockoon-pro-service port: targetPort: 5020 tls: termination: edge

 Kubernetes Ingress + cert-manager

On Kubernetes, attach a single-domain certificate (for path-based routing) or a wildcard certificate (for subdomain routing, as shown below) to your Ingress:

Copy
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: mockoon-ingress annotations: cert-manager.io/cluster-issuer: letsencrypt-dns01 spec: tls: - hosts: - 'mockoon.company.com' - '*.mockoon.company.com' # Only needed for subdomain routing secretName: mockoon-tls-secret rules: - host: 'mockoon.company.com' http: paths: - path: / pathType: Prefix backend: service: name: mockoon-pro-service port: number: 5020 # Only needed for subdomain routing: - host: '*.mockoon.company.com' http: paths: - path: / pathType: Prefix backend: service: name: mockoon-pro-service port: number: 5020

 Option 4: Direct TLS termination

To have the Mockoon container serve TLS directly without a reverse proxy, set USE_HTTPS=true and mount your certificate files. Map host port 443 to container port 5020:

Copy
docker run -d \ --name mockoon-pro \ --stop-timeout 30 \ -p 443:5020 \ -e USE_HTTPS=true \ -e MOCKOON_DOMAIN=mockoon.company.com \ -e MOCKOON_SERVER_ID=mockoon-prod \ -e MOCKOON_TLS_CERT_PATH=/certs/fullchain.pem \ -e MOCKOON_TLS_KEY_PATH=/certs/privkey.pem \ -v mockoon-data:/data \ -v /path/to/certs:/certs:ro \ mockoon/pro:latest