Skip to content

Setup Mockpit via Docker Compose

Sran Manpreet edited this page Sep 7, 2023 · 3 revisions

Simplify the setup of Mockpit by utilizing Docker Compose, which streamlines the process of configuring the database and launching both mockpit-server and mockpit-client with a single command.

Locate the docker-compose.yml file at the project's root directory. Customize this file according to your specific requirements.

version: '3'
services:
  mockpit-server:
    container_name: mockpit-server
    image: sranmanpreet/mockpit-server:<version>-RELEASE
    ports:
      - "8080:8080"
    depends_on:
      - "db"
    environment:
      SPRING_APPLICATION_JSON: '{
              "spring.datasource.url"  : "jdbc:postgresql://db:5432/mockpitdb",
              "spring.datasource.username" : "mockpitadmin",
              "spring.datasource.password" : "admin"
            }'

  mockpit-client:
    image: sranmanpreet/mockpit-client:<version>-RELEASE
    environment:
      backendUrl: http://localhost:8080
    ports:
      - "4200:80"

  db:
    container_name: db
    image: postgres:15
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: mockpitdb
      POSTGRES_USER: mockpitadmin
      POSTGRES_PASSWORD: admin
    volumes:
      - "mockpitpgdata:/var/lib/postgresql/data"
    command: -p 5432
volumes:
  mockpitpgdata:

To start Mockpit through Docker Compose, run the following command from the root of your project:

docker-compose -f docker-compose.yml up -d

Upon executing this command, Mockpit will be accessible at http://localhost:4200.

This Docker Compose configuration automates the process of deploying Mockpit alongside the necessary database, providing an efficient way to manage and launch the application.