Skip to main content
Version: 0.8.x [Latest Beta]

Docker deployment

Rules that apply to every container

  1. Mount /etc/machine-id into the container under the same path.
  2. Mount a persistent host directory onto the SDK default data directory inside the container so offline license state, TensorRT caches, and OpenVINO caches survive restarts. On Linux the default is $XDG_CONFIG_HOME/denkflow if XDG_CONFIG_HOME is set, otherwise $HOME/.config/denkflow. Most images in the recipes below run as root, so mount your host volume at /root/.config/denkflow. If your image uses a non-root user, mount at that user's $HOME/.config/denkflow instead.
  3. Use a glibc-based image such as Debian, Ubuntu, or an NVIDIA runtime image; Alpine is not supported.

You can still set DENKFLOW_DATA_DIRECTORY to a custom path if you prefer. It is not required when you mount at the default location.

All Python recipes below use the same build argument for the private package registry:

ARG DENKFLOW_PYPI_INDEX_URL=https://__token__:gldt-JCgXB7jPAo_b6JXAckFV@gitlab.com/api/v4/projects/69262737/packages/pypi/simple

That keeps PyPI available for public packages such as fastapi, pillow, and python-multipart while still letting pip resolve denkflow from the private registry.

Example run command (persistent data at the SDK default path for root):

docker run --rm -it \
-v /etc/machine-id:/etc/machine-id:ro \
-v /srv/denkflow-data:/root/.config/denkflow \
your-image:latest

Example build command:

docker build \
--build-arg DENKFLOW_PYPI_INDEX_URL="https://__token__:gldt-JCgXB7jPAo_b6JXAckFV@gitlab.com/api/v4/projects/69262737/packages/pypi/simple" \
-t your-image:latest .

Container 1: CPU-only Linux x86_64

FROM python:3.12-slim
ARG DENKFLOW_PYPI_INDEX_URL

ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_EXTRA_INDEX_URL=${DENKFLOW_PYPI_INDEX_URL}

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libgomp1 \
&& rm -rf /var/lib/apt/lists/*

RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install denkflow[cpu]

WORKDIR /app

The [cpu] extra installs onnxruntime, which denkflow requires at import time. Plain pip install denkflow will fail with ModuleNotFoundError: No module named 'onnxruntime'.

Container 2: OpenVINO Linux x86_64

FROM python:3.12-slim
ARG DENKFLOW_PYPI_INDEX_URL

ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_EXTRA_INDEX_URL=${DENKFLOW_PYPI_INDEX_URL}

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libgomp1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install denkflow[openvino]

WORKDIR /app

Use this for Intel CPU deployments. It also works for Intel GPU and Intel NPU deployments if the host already provides the required Intel driver stack and you pass the needed devices into the container.

For Intel GPU and Intel NPU containers on Linux, you typically also need /dev/dri:

docker run --rm -it \
--device /dev/dri \
-v /etc/machine-id:/etc/machine-id:ro \
-v /srv/denkflow-data:/root/.config/denkflow \
your-openvino-image:latest

Container 3: CUDA Linux x86_64

FROM nvidia/cuda:12.6.1-cudnn-runtime-ubuntu22.04
ARG DENKFLOW_PYPI_INDEX_URL

ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_EXTRA_INDEX_URL=${DENKFLOW_PYPI_INDEX_URL}

ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
ENV LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/onnxruntime/capi:${LD_LIBRARY_PATH}

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
python3 \
python3-pip \
python3-venv \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --upgrade pip setuptools wheel \
&& python3 -m pip install denkflow[gpu]

WORKDIR /app

The cudnn-runtime variant of the CUDA base image is required: ONNX Runtime's CUDA execution provider links against libcudnn.so.9, which the plain 12.6.1-runtime-ubuntu22.04 image does not contain.

Run it with the NVIDIA container runtime:

docker run --rm -it --gpus all \
-v /etc/machine-id:/etc/machine-id:ro \
-v /srv/denkflow-data:/root/.config/denkflow \
your-cuda-image:latest

Container 4: TensorRT Linux x86_64

FROM nvcr.io/nvidia/tensorrt:24.10-py3
ARG DENKFLOW_PYPI_INDEX_URL

ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_EXTRA_INDEX_URL=${DENKFLOW_PYPI_INDEX_URL}

ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
ENV LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/onnxruntime/capi:${LD_LIBRARY_PATH}

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libgomp1 \
&& rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --upgrade pip setuptools wheel \
&& python3 -m pip install denkflow[gpu]

WORKDIR /app

Notes:

  • When using TensorRT, the first model run can take significantly longer than subsequent ones
  • Keep the cache volume persistent to avoid repeated rebuilds of the TensorRT cache
  • This image already provides the TensorRT user-space stack; it is the simplest documented TensorRT base for Linux x86_64
  • If you change the base image Python version or CPU architecture, adjust the LD_PRELOAD and LD_LIBRARY_PATH paths accordingly.

Container 5: Jetson Orin

FROM nvcr.io/nvidia/l4t-jetpack:r36.4.0
ARG DENKFLOW_PYPI_INDEX_URL

ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_EXTRA_INDEX_URL=${DENKFLOW_PYPI_INDEX_URL}

ENV LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libstdc++.so.6
ENV LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/onnxruntime/capi:${LD_LIBRARY_PATH}

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libgomp1 \
python3-pip \
python3-venv \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --upgrade pip setuptools wheel \
&& python3 -m pip install denkflow[gpu]

WORKDIR /app

Use this as the preferred Jetson starting point for Orin-class devices. The l4t-jetpack:r36.4.0 base image bundles the full JetPack 6 user-space stack (CUDA 12.6, cuDNN 9, TensorRT 10.3) so ONNX Runtime's CUDA and TensorRT execution providers can load without relying on host-mounted JetPack libraries.

The LD_PRELOAD and LD_LIBRARY_PATH paths use the aarch64 multiarch directory and Python 3.10 site-packages location of the l4t-jetpack:r36.4.0 base image; adjust them if you change the base image Python version.

Run it with the NVIDIA runtime on Jetson:

docker run --rm -it \
--runtime nvidia \
-v /etc/machine-id:/etc/machine-id:ro \
-v /srv/denkflow-data:/root/.config/denkflow \
your-jetson-image:latest