Skip to main content

SD.Next openvino docker compose

Install

vi Dockerfile
vi docker-compose.yml
docker compose up -d
docker logs sdnext-openvino --follow
#docker compose down

Dockerfile

example without proxy on branch master

# SD.Next OpenVINO Dockerfile
# docs: <https://github.com/vladmandic/sdnext/wiki/Docker>

# base image
FROM ubuntu:noble

# metadata
LABEL org.opencontainers.image.vendor="SD.Next"
LABEL org.opencontainers.image.authors="disty0"
LABEL org.opencontainers.image.url="https://github.com/vladmandic/sdnext/"
LABEL org.opencontainers.image.documentation="https://github.com/vladmandic/sdnext/wiki/Docker"
LABEL org.opencontainers.image.source="https://github.com/vladmandic/sdnext/"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
LABEL org.opencontainers.image.title="SD.Next OpenVINO"
LABEL org.opencontainers.image.description="SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models"
LABEL org.opencontainers.image.base.name="https://hub.docker.com/_/ubuntu:noble"
LABEL org.opencontainers.image.version="latest"

# essentials
RUN apt-get update && \
    apt-get install -y --no-install-recommends --fix-missing \
    software-properties-common \
    build-essential \
    ca-certificates \
    wget \
    gpg \
    git

# intel compute runtime
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
RUN echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu noble client" | tee /etc/apt/sources.list.d/intel-gpu-noble.list
RUN apt-get update

RUN apt-get install -y --no-install-recommends --fix-missing \
    intel-opencl-icd \
    libze-intel-gpu1 \
    libze1

# required by pytorch / ipex
RUN apt-get install -y --no-install-recommends --fix-missing \
    libgl1 \
    libglib2.0-0 \
    libgomp1

# python3.12
RUN apt-get install -y --no-install-recommends --fix-missing \
    python3 \
    python3-dev \
    python3-venv \
    python3-pip

# cleanup
RUN /usr/sbin/ldconfig
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# stop pip and uv from caching
ENV PIP_NO_CACHE_DIR=true
ENV UV_NO_CACHE=true

# set paths to use with sdnext
ENV SD_DOCKER=true
ENV SD_DATADIR="/mnt/data"
ENV SD_MODELSDIR="/mnt/models"
ENV venv_dir="/mnt/python/venv"

# paths used by sdnext can be a volume if necessary
#VOLUME [ "/app" ]
#VOLUME [ "/mnt/data" ]
#VOLUME [ "/mnt/models" ]
#VOLUME [ "/mnt/python" ]
#VOLUME [ "/root/.cache/huggingface" ]

# git clone and run sdnext
RUN echo '#!/bin/bash\ngit status || git clone https://github.com/vladmandic/sdnext.git .\n/app/webui.sh "$@"' | tee /bin/startup.sh
RUN chmod 755 /bin/startup.sh

# actually run sdnext
WORKDIR /app
ENTRYPOINT [ "startup.sh", "-f", "--use-openvino", "--uv", "--listen",  "--insecure", "--update", "--debug", "--api-log", "--log", "sdnext.log" ]

# expose port
EXPOSE 7860

# healthcheck function
# HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 CMD curl --fail http://localhost:7860/sdapi/v1/status || exit 1

# stop signal
STOPSIGNAL SIGINT

example with proxy

 (to be removed or replaced to one is working) and on Developer branch

# SD.Next OpenVINO Dockerfile
# docs: <https://github.com/vladmandic/sdnext/wiki/Docker>

# base image
FROM ubuntu:noble

# metadata
LABEL org.opencontainers.image.vendor="SD.Next"
LABEL org.opencontainers.image.authors="disty0"
LABEL org.opencontainers.image.url="https://github.com/vladmandic/sdnext/"
LABEL org.opencontainers.image.documentation="https://github.com/vladmandic/sdnext/wiki/Docker"
LABEL org.opencontainers.image.source="https://github.com/vladmandic/sdnext/"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
LABEL org.opencontainers.image.title="SD.Next OpenVINO"
LABEL org.opencontainers.image.description="SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models"
LABEL org.opencontainers.image.base.name="https://hub.docker.com/_/ubuntu:noble"
LABEL org.opencontainers.image.version="latest"

# essentials
RUN apt-get update && \
    apt-get install -y --no-install-recommends --fix-missing \
    software-properties-common \
    build-essential \
    ca-certificates \
    wget \
    gpg \
    git

# intel compute runtime
RUN https_proxy=http://proxy.example.com:18080/  wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
RUN echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu noble client" | tee /etc/apt/sources.list.d/intel-gpu-noble.list
RUN https_proxy=http://proxy.example.com:18080/  apt-get update

RUN https_proxy=http://proxy.example.com:18080/  apt-get install -y --no-install-recommends --fix-missing \
    intel-opencl-icd \
    libze-intel-gpu1 \
    libze1

# required by pytorch / ipex
RUN https_proxy=http://proxy.example.com:18080/  apt-get install -y --no-install-recommends --fix-missing \
    libgl1 \
    libglib2.0-0 \
    libgomp1

# python3.12
RUN https_proxy=http://proxy.example.com:18080/  apt-get install -y --no-install-recommends --fix-missing \
    python3 \
    python3-dev \
    python3-venv \
    python3-pip

# cleanup
RUN /usr/sbin/ldconfig
RUN https_proxy=http://proxy.example.com:18080/  apt-get clean && rm -rf /var/lib/apt/lists/*

# stop pip and uv from caching
ENV PIP_NO_CACHE_DIR=true
ENV UV_NO_CACHE=true

# set paths to use with sdnext
ENV SD_DOCKER=true
ENV SD_DATADIR="/mnt/data"
ENV SD_MODELSDIR="/mnt/models"
ENV venv_dir="/mnt/python/venv"

# paths used by sdnext can be a volume if necessary
#VOLUME [ "/app" ]
#VOLUME [ "/mnt/data" ]
#VOLUME [ "/mnt/models" ]
#VOLUME [ "/mnt/python" ]
#VOLUME [ "/root/.cache/huggingface" ]

# git clone and run sdnext
RUN echo '#!/bin/bash\ngit status || git clone https://github.com/vladmandic/sdnext.git -b dev .\n/app/webui.sh "$@"' | tee /bin/startup.sh
RUN chmod 755 /bin/startup.sh

# actually run sdnext
WORKDIR /app
ENTRYPOINT [ "startup.sh", "-f", "--use-openvino", "--uv", "--listen",  "--insecure", "--server-name sdnext.example.com", "--update", "--debug", "--api-log", "--log", "sdnext.log" ]

# expose port
EXPOSE 7860

# healthcheck function
# HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 CMD curl --fail http://localhost:7860/sdapi/v1/status || exit 1

# stop signal
STOPSIGNAL SIGINT

docker-compose.yml

services:
  sdnext-openvino:
    build:
      dockerfile: Dockerfile
    image: sdnext-openvino:latest
    container_name: sdnext-openvino
    restart: unless-stopped
    devices:
      - /dev/dri:/dev/dri
      - /dev/accel:/dev/accel
#    environment:
#      - https_proxy=http://proxy.example.com:18080/
    ports:
      - 7860:7860
    volumes:
      - /docker/sdnext/app-volume:/app
      - /docker/sdnext/mnt-volume:/mnt
      - /docker/sdnext/huggingface-volume:/root/.cache/huggingface
      - /docker/sdnext/python-volume:/usr/local/lib/python3.10
      - /dev/shm:/dev/shm

Application screenshots

image.png

image.png

Post-install fixes

add some python libraries

That is not something you beed to do, but in rare case of it kind of missing in requirements.txt

# In case of some dependencies is missing (like sentencepiece in Dev branch at 2025-07-14)
# docker exec -it sdnext-openvino bash
python3 -m venv /mnt/python/venv
/mnt/python/venv/bin/pip3 install sentencepiece

Fix access to gated repo

 (in case access is granted and token available)

Access error to gated repo

sdnext-ipex  | 20:01:16-163840 ERROR    Load model: repo="black-forest-labs/FLUX.1-Kontext-dev"
sdnext-ipex  |                          login=True 401 Client Error. (Request ID:
sdnext-ipex  |                          Root=1-6875620c-4ddbac246caa80376513448a;bea8cc0a-fb48-
sdnext-ipex  |                          452c-a738-debd0038cb43)
sdnext-ipex  |
sdnext-ipex  |                          Cannot access gated repo for url
sdnext-ipex  |                          https://huggingface.co/api/models/black-forest-labs/FLU
sdnext-ipex  |                          X.1-Kontext-dev/auth-check.
sdnext-ipex  |                          Access to model black-forest-labs/FLUX.1-Kontext-dev is
sdnext-ipex  |                          restricted. You must have access to it and be
sdnext-ipex  |                          authenticated to access it. Please log in.

login to huggingface manually

# docker exec -it sdnext-openvino bash
# export venv_dir=/mnt/python/venv/
source "${venv_dir}"/bin/activate
git config --global credential.helper store
/mnt/python/venv/bin/huggingface-cli login
# docker restart sdnext-openvino
# Download or use the model after a restart


System info

app: sdnext.git updated: 2025-07-14 hash: 79d0fb81 url: https://github.com/vladmandic/sdnext.git/tree/dev
arch: x86_64 cpu: x86_64 system: Linux release: 6.11.0-29-generic
python: 3.12.3 Torch: 2.7.1+cpu
device: Intel(R) Arc(TM) Graphics (iGPU) openvino: 2025.2.0
ram: free:95.64 used:29.69 total:125.33 gpu: total:125.33
xformers:  diffusers: 0.35.0.dev0 transformers: 4.53.2
active: cpu dtype: torch.float32 vae: torch.float32 unet: torch.float32
base: Diffusers/nvidia/Cosmos-Predict2-2B-Text2Image [acdb5fde99] refiner: none vae: none te: none unet: none

app: sdnext.git updated: 2025-08-02 hash: e90ac68d url: https://github.com/vladmandic/sdnext.git/tree/dev
arch: x86_64 cpu: x86_64 system: Linux release: 6.14.0-27-generic
python: 3.12.3 Torch: 2.7.1+cpu
device: Intel(R) Iris(R) Xe Graphics (iGPU) openvino: 2025.2.0
ram: free:59.83 used:34.14 total:93.97 gpu: total:93.97
xformers:  diffusers: 0.35.0.dev0 transformers: 4.54.1
active: cpu dtype: torch.float32 vae: torch.float32 unet: torch.float32
base: Diffusers/Kwai-Kolors/Kolors-diffusers [7e091c7519] refiner: none vae: none te: none unet: none

openvino (float32) note

Memory consumption in openvino (float32) significantly higher than ipex (bfloat16) so it may cause OOM on same HW with same models than ipex is OK with (Flux.1 dev kontext example, openvino/gpu iGPU Intel Arc)

image.png

Reinstall

Clean reinstall

Remove all sdnext related date and have clean install

docker compose down --rmi local
docker system prune --all --force
rm -Rf /docker/sdnext/*
docker compose up -d
docker compose logs --follow

Preserve downloaded models

save the models and output images

docker compose down --rmi local
docker system prune --all --force
rm -Rf /docker/sdnext/app-volume/ /docker/sdnext/python-volume/ /docker/sdnext/mnt-volume/python/
docker compose up -d
docker compose logs --follow

Config example for iGPU

cat /docker/sdnext/mnt-volume/data/config.json
{
  "no_half": false,
  "openvino_devices": [
    "GPU"
  ],
  "samples_filename_pattern": "[seq]-[date]-[model_name]-[height]x[width]-Seed[seed]-CFG[cfg]-STEP[steps]",
}

Config example for CPU

{
  "no_half": false,
  "openvino_devices": [
    "CPU"
  ],
  "samples_filename_pattern": "[seq]-[date]-[model_name]-[height]x[width]-Seed[seed]-CFG[cfg]-STEP[steps]",
  "device_map": "cpu",
  "diffusers_generator_device": "CPU"
}

Example image generation on CPU

Openvino CPU on Intel core i7-1355U + 96GB DDR5 (25/55W power limits)

Model resolution time (at 20 STEPS)
Kolors 1280x1280 34m 51.83s
TempestV0.1-Artistic (SDXL) 1280x1280 34m 5.18s




openvino-cpu-kolors-1280px.jpg

Prompt: car

Parameters: Steps: 20| Size: 1280x1280| Seed: 1747916893| CFG scale: 6| App: SD.Next| Version: e90ac68| Pipeline: KolorsPipeline| Operations: txt2img| Model: Kolors-diffusers

Execution: Time: 34m 51.83s | total 2091.82 pipeline 1960.52 decode 131.16 | RAM 90.33 GB 96%

openvino-cpu-kolors-1024px.jpg

Prompt: car

Parameters: Steps: 20| Size: 1024x1024| Seed: 3229942612| CFG scale: 6| App: SD.Next| Version: e90ac68| Pipeline: KolorsPipeline| Operations: txt2img| Model: Kolors-diffusers