Installation

Install moclojer in minutes with Docker, JAR, or native binary. Step-by-step guide with verification steps and troubleshooting. Get your mock server running on Linux, macOS, or Windows.

Get moclojer running on your system in just a few minutes. Choose the installation method that works best for your setup.

The fastest way to try moclojer is with Docker:

docker run -it -p 8000:8000 ghcr.io/moclojer/moclojer:latest

This will start moclojer on port 8000 with a default configuration. You can now test it by visiting http://localhost:8000 in your browser.

Installation Methods

Docker is the easiest way to get started, especially for trying moclojer or using it in development.

Requirements:

  • Docker installed on your system

Basic usage:

# Run with default configuration
docker run -it -p 8000:8000 ghcr.io/moclojer/moclojer:latest

# Run with your own configuration file
docker run -it \
  -p 8000:8000 \
  -v $(pwd)/moclojer.yml:/app/moclojer.yml \
  ghcr.io/moclojer/moclojer:latest

Available Docker tags:

  • latest - Latest stable release

  • dev - Latest development version from main branch

Custom port:

📚 For production deployments: See the complete Docker Deployment Guide for Docker Compose, multi-environment setup, and CI/CD integration.

☕ Standalone JAR

The JAR file works on any system with Java installed. Perfect for CI/CD, scripts, or when you don't want to use Docker.

Requirements:

  • Java 11 or higher

Download and run:

Quick installation script:

Note: On Linux, you might need sudo for the installation script.

📦 Native Binary (Linux)

For Linux systems, we provide a native binary that doesn't require Java.

Download:

Usage:

🔧 From Source (Clojure)

If you're a Clojure developer or want to contribute to moclojer.

Requirements:

  • Clojure CLI tools installed

  • Git

Clone and run:

Build your own JAR:

Verification

After installation, verify that moclojer is working:

  1. Create a simple configuration file named moclojer.yml:

  1. Start moclojer with your configuration:

  1. Test the endpoint:

You should see:

Configuration

By default, moclojer looks for configuration files in these locations:

  1. ./moclojer.yml (current directory)

  2. ~/.config/moclojer.yml (user config directory)

  3. /etc/moclojer.yml (system config)

You can specify a custom configuration file with the --config option:

Environment Variables

Configure moclojer using environment variables:

Variable
Description
Default

PORT

Server port

8000

CONFIG

Configuration file path

~/.config/moclojer.yml

MOCKS

Mocks file path (alternative to CONFIG)

-

SENTRY_DSN

Sentry DSN for error reporting

-

Example:

Command Line Options

Option
Description

-c, --config PATH

Configuration file path

-m, --mocks PATH

OpenAPI v3 mocks file path

-f, --format FORMAT

Output format (println or json)

-h, --help

Show help information

-v, --version

Show version information

📚 For all CLI options: See the complete CLI Reference with detailed examples and use cases.

Troubleshooting

Port already in use

If port 8000 is already in use:

Java not found

Make sure Java 11+ is installed:

Configuration file not found

Ensure your configuration file exists and is readable:

Docker permission denied

On Linux, you might need to add your user to the docker group:

📚 More issues? Check the complete Troubleshooting Guide with solutions for 20+ common problems.

Next Steps

Now that moclojer is installed, let's create your first mock server:

👉 Your First Mock Server

Need Help?

See Also

Last updated

Was this helpful?