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.
/data.mockoon.company.com, replace with your own domain).*.mockoon.company.com) if using subdomain routing (default). Not required for path-based routing (https://mockoon.company.com/mocks/{subdomain}).mockoon.company.com and *.mockoon.company.com for subdomain routing, or a standard single-domain certificate for path-based routing.💡 In the configuration examples below, mockoon.company.com is used as a placeholder. Replace it with your own chosen domain. For local evaluation and development, you can omit the domain configuration or use localhost. Modern browsers automatically resolve *.localhost (such as mock-1.localhost) to 127.0.0.1 and treat it as a secure context.
The official image runs in production mode and listens on container port 5020. These defaults are already configured inside the image.
You can run Mockoon Pro with a standard docker run command:
Copydocker 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
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.
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.
docker-compose.yml file:Copyservices: 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:
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 } }
If you already terminate TLS at an external load balancer or firewall:
Copyservices: 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:
Mockoon Pro is compatible with Kubernetes and OpenShift environments:
GID 0) permissions (chgrp 0 /data && chmod g+rwX /data) to seamlessly support OpenShift's arbitrary non-root UID security context constraints (SCC).ReadWriteOnce (RWO) PVC to /data.mockoon.company.com)—and wildcard subdomains (*.mockoon.company.com) if using subdomain routing—to container port 5020.CopyapiVersion: 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
Allow 30 seconds for shutdowns, restarts, and updates so Mockoon Pro can persist pending changes.
--stop-timeout 30 when creating the container, or docker stop -t 30 mockoon-pro for an existing container.stop_grace_period: 30s on the Pro service. Apply changes with docker compose up -d.terminationGracePeriodSeconds: 30 explicitly in the pod template.Forced stops can interrupt writes and lose pending changes.
The application is configured through environment variables passed to the container:
| Variable | Required | Default | Description |
|---|---|---|---|
MOCKOON_DOMAIN | Optional | localhost | Base domain for routing (e.g. mockoon.company.com). If omitted, defaults to localhost. |
MOCKOON_STORAGE_DIR | Optional | /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_ID | Required | mockoon-pro-test | Server label used in logs and deployment audit metadata (lowercase letters, digits and hyphens only). This variable should not be changed after initial setup. |
USE_HTTPS | Optional | Auto-inferred | Force 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_PATH | Optional | None | Path 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_PATH | Optional | None | Path to the server private key when using Direct TLS. |
MOCKOON_TLS_CA_PATH | Optional | None | Path to the CA certificate when using Direct TLS. |
MOCKOON_TRUST_PROXY | Optional | None | Comma-separated trusted reverse proxy IPs or CIDRs for resolving client IPs. No proxies are trusted by default. See 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:
CopyMOCKOON_TRUST_PROXY=127.0.0.1,::1
For a dedicated Docker proxy network, an example configuration is:
Copyenvironment: 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.
Mockoon Pro serves multiple interfaces from your base domain:
https://mockoon.company.comhttps://mockoon.company.com/appwss://mockoon.company.comhttps://{subdomain}.mockoon.company.comhttps://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):
mockoon.company.com and a Wildcard Record for *.mockoon.company.com pointing to your reverse proxy / ingress IP.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).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:
*.mockoon.company.com if using path-based routing):Copyhttps://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:
Copyvolumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - ./certs:/etc/ssl/certs:ro
Copyserver { 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"; } }
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:
⚠️ Certificate Transparency Notice: With On-Demand TLS, public certificate authorities (Let's Encrypt / ZeroSSL) log each newly issued mock subdomain certificate to public Certificate Transparency (CT) logs. Internet scanners monitor these logs and may probe newly detected subdomains. For private mock subdomains, prefer using a Wildcard Certificate (Option 1) or Path-based routing.
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:
CopyapiVersion: 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:
CopyapiVersion: 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
On Kubernetes, attach a single-domain certificate (for path-based routing) or a wildcard certificate (for subdomain routing, as shown below) to your Ingress:
CopyapiVersion: 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
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:
Copydocker 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
⚠️ If using subdomain routing, the certificate must be a wildcard certificate valid for both mockoon.company.com and *.mockoon.company.com. For path-based routing, a standard certificate for mockoon.company.com is sufficient.