Skip to content

Docker Usage

This page describes how to build and run KinOpt inside a Docker container.


Dockerfile Overview

The included Dockerfile uses the Pixi base image, installs the locked Pixi environment, copies the project source, and sets PYTHONPATH=/app so local modules are importable.

FROM ghcr.io/prefix-dev/pixi:latest

WORKDIR /app

COPY pixi.toml pixi.lock* /app/
RUN pixi install --locked || pixi install

COPY . /app
ENV PYTHONPATH=/app

CMD ["pixi", "run", "kinopt-local"]

The default command runs the local KinOpt optimization task.


Build

docker build -t kinopt .

Run

Local Optimization

docker run --rm \
  -v "$PWD/data:/app/data" \
  -v "$PWD/results:/app/results" \
  kinopt

Fit Analysis

docker run --rm \
  -v "$PWD/data:/app/data" \
  -v "$PWD/results:/app/results" \
  kinopt pixi run kinopt-fitanalysis

Custom Configuration

docker run --rm \
  -v "$PWD/config.toml:/app/config.toml" \
  -v "$PWD/data:/app/data" \
  -v "$PWD/results:/app/results" \
  kinopt pixi run kinopt-local

The container reads config.toml from /app/. Mount a replacement file at that path to override the checked-in configuration.


Notes

  • Mount output directories when running containers so result files persist after the container exits.
  • The image installs dependencies from pixi.toml and pixi.lock; rebuild the image after changing dependencies.
  • The Docker default command can be overridden with any Pixi task defined in pixi.toml.