Run This Ai
EN DE

How to Deploy stable-diffusion.cpp with Docker: Step-by-Step Setup Guide

Learn how to run stable-diffusion.cpp in a container — pull the image, generate your first image, and use img2img and ControlNet with quantized GGUF models.

In this tutorial you will deploy stable-diffusion.cpp in Docker and generate your first image. Because the engine is a single native binary with no Python runtime, the container stays small, starts fast, and runs happily on CPU-only servers — making it a great fit for a self-hosted image generation API.

🚀 Want to deploy stable-diffusion.cpp yourself?

Docker configs, system requirements, and installation guides — all on one page.

View stable-diffusion.cpp Tool Page →

Step 1 — Pull the image

The community image guaricema/stable-diffusion.cpp (25K+ pulls) wraps the native binary with a ready-to-use HTTP server. Start it with:

docker run -d --name sd-cpp -p 8080:8080 \
  -v ./models:/models guaricema/stable-diffusion.cpp

Step 2 — Download a quantized model

Quantized GGUF checkpoints keep RAM usage low. Drop a Stable Diffusion 1.5 GGUF file into your ./models volume, then confirm the container sees it:

docker exec sd-cpp ls -lh /models

Step 3 — Generate your first image

Point your HTTP client at the server and pass a prompt. With the LCM or standard sampler you can go from text to image in seconds on CPU:

curl -X POST http://localhost:8080/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a lovely cat, studio lighting","steps":20}' \
  -o output.png
img2img output from stable-diffusion.cpp

Step 4 — Advanced: img2img and ControlNet

Beyond txt2img, stable-diffusion.cpp supports img2img and ControlNet. The image above shows an img2img result — supply a source image plus a prompt, and the engine redraws it while preserving structure. LoRA adapters load via the --lora flag, and --backend switches between CPU, CUDA and Vulkan at runtime.

SetupValue
Imageguaricema/stable-diffusion.cpp
Port8080
Min RAM4 GB (rec. 8 GB)
Min CPU2 cores (rec. 4)

That's it — a Python-free diffusion server, up in under five minutes. For the full docker-compose template and hardware requirements, check the tool page below.

🚀 Want to deploy stable-diffusion.cpp yourself?

Docker configs, system requirements, and installation guides — all on one page.

View stable-diffusion.cpp Tool Page →
#stable-diffusion #docker #tutorial #image-generation