Local deployment

Describes how to run Opik locally using Docker Compose

Important: If you’re using or looking to use Opik or Comet enterprise version please reach out to Sales@comet.com to gain access to the correct deployment documentation.

To run Opik locally we recommend using Docker Compose. It’s easy to setup and allows you to get started in a couple of minutes but is not meant for production deployments. If you would like to run Opik in a production environment, we recommend using our Kubernetes Helm chart.

Before running the installation, make sure you have Docker and Docker Compose installed:

If you are using Mac or Windows, both docker and docker compose are included in the Docker Desktop installation.

Installation

To install Opik, you will need to clone the Opik repository and run the following commands:

$# Clone the Opik repository
>git clone https://github.com/comet-ml/opik.git
>
># Navigate to the opik folder
>
>cd opik
>
># Start the Opik platform
>
>./opik.sh

Opik will now be available at http://localhost:5173

In order to use the Opik Python SDK with your local Opik instance, you will need to run:

$pip install opik
>
>opik configure --use_local

or in python:

1import opik
2
3opik.configure(use_local=True)

This will create a ~/.opik.config file that will store the URL of your local Opik instance.

All the data logged to the Opik platform will be stored in the ~/opik directory, which means that you can start and stop the Opik platform without losing any data.

Stopping the Opik platform

You can stop the Opik server by running the following commands:

$# Ensure you are running this command for the root of the Opik repository you cloned
>./opik.sh --stop

Note: You can safely stop the Opik platform without losing any data.

Upgrading and restarting the Opik platform

To upgrade or restart the Opik platform, you can simply run the opik script again:

$# Ensure you are running this command for the root of the Opik repository you cloned
>./opik.sh

Since the Docker Compose deployment is using mounted volumes, your data will not be lost when you upgrade Opik. You can also safely start and stop the Opik platform without losing any data.

Advanced configuration - Docker compose

Using Docker Compose directly instead of using the opik.sh or opik.ps1 scripts provides you with some additional options.

Starting Opik with Docker Compose

Instead of using the opik.sh or opik.ps1 scripts, you can also run The docker compose command directly:

$# Navigate to the opik/deployment/docker-compose directory
>cd opik/deployment/docker-compose
>
># Start, upgrade or restart the Opik platform
>docker compose up --detach

Uninstalling Opik

To remove Opik, you will need to remove the Opik containers and volumes:

$# Navigate to docker compose folder
>cd deployment/docker-compose
>
># Remove the Opik containers and volumes
>docker compose down --volumes

Removing the volumes will delete all the data stored in the Opik platform and cannot be recovered. We do not recommend this option unless you are sure that you will not need any of the data stored in the Opik platform.

Running a specific version of Opik

You can run a specific version of Opik by setting the OPIK_VERSION environment variable:

$OPIK_VERSION=latest docker compose up

Building the Opik platform from source

You can also build the Opik platform from source by running the following command:

$# Clone the Opik repository
>git clone https://github.com/comet-ml/opik.git
>
># Navigate to the opik/deployment/docker-compose directory
>cd opik/deployment/docker-compose
>
># Build the Opik platform from source
>docker compose up --build

This will build the Frontend and Backend Docker images and start the Opik platform.