A reproducible, persistent Docker setup for running AUTOMATIC1111's Stable Diffusion WebUI with GPU acceleration, extension support, and clean config management.
Everything the WebUI needs — Python environment, requirements, and the sub-repositories A1111 depends on — is baked into the image at build time, pinned to a known-good release. First launch needs no network access and no surprise downloads.
📖 Need to install Docker or the NVIDIA Container Toolkit?
See the HOWTO guide for step-by-step instructions for Ubuntu/Debian, Fedora, Arch, and WSL.
📘 New to Docker or AUTOMATIC1111 in general?
Check out the GETTING_STARTED.md guide for a plain-language introduction: what Docker is, what A1111 does, what's persistent vs. ephemeral in this build, and how to add your first models.
Prerequisites: Docker Engine, Docker Compose plugin, and the NVIDIA Container Toolkit must be installed. If you need help setting these up, see the HOWTO guide.
git clone https://github.com/tsondo/a1111-docker.git ~/a1111-docker
cd ~/a1111-docker
bash setup.sh --pullThat's it. setup.sh creates the persistent folders and config files, pulls the prebuilt image (about a 7 GB download), and starts the container. Access the WebUI at http://localhost:7860
Prefer to build the image yourself? Run bash setup.sh without --pull — see Building locally below.
A .env file is optional — the defaults work out of the box. Copy .env.sample to .env if you want to customize where models, outputs, etc. are stored.
Prerequisites: Docker Desktop with WSL2 integration and the NVIDIA Container Toolkit. See the HOWTO guide for full setup steps.
Once Docker is working inside your WSL terminal:
git clone https://github.com/tsondo/a1111-docker.git ~/a1111-docker
cd ~/a1111-docker
bash setup.sh --pullAccess the WebUI at http://localhost:7860 from your Windows browser.
Important: Run all commands inside WSL -- not PowerShell or CMD. Keep the folder inside the Linux filesystem (~/a1111-docker), not under /mnt/c/, for much better performance.
The same two commands work on AMD: setup.sh auto-detects an AMD GPU (via /dev/kfd) and uses the ROCm image (ghcr.io/tsondo/a1111-docker:latest-rocm) automatically. Requirements are simpler than NVIDIA's — just native Linux with the standard amdgpu kernel driver (included in every modern distro). No container toolkit needed. ROCm is not supported under WSL2 — Linux only.
Two AMD-specific notes:
- xformers is CUDA-only, so the ROCm variant uses PyTorch's built-in SDP attention instead. This happens automatically.
- Many consumer cards need a compatibility override before generation works. If the container starts but generating images fails or crashes, copy
.env.sampleto.envand uncommentHSA_OVERRIDE_GFX_VERSION: use10.3.0for RX 6000-series cards,11.0.0for RX 7000-series. Then restart.
This variant is untested on real hardware so far — if you run it, success or failure reports are very welcome as GitHub issues.
A ready-to-run image is published to GitHub Container Registry as ghcr.io/tsondo/a1111-docker, built by CI from this repo with A1111 pinned to a known-good release. bash setup.sh --pull uses it automatically. If the pull fails (e.g. no network to GHCR), the script falls back to building locally.
Running bash setup.sh without --pull builds the same image on your machine instead. This downloads several GB of CUDA wheels and takes a while, but is useful if you want to modify the Dockerfile or pin a different A1111 version.
- Creates persistent folders for models, outputs, extensions, etc.
- Prepopulates empty config files if missing
- Records your user/group ID so files created by the container are owned by you
- Migrates settings from older versions of this project
- Builds (or pulls, with
--pull) the image and starts the container
Flags: --pull (use prebuilt image), --no-cache (full rebuild), -d/--detach (run in background), --rocm/--nvidia (force a GPU variant), -h (help).
These folders are mounted into the container and survive restarts and rebuilds:
| Host Folder | Container Path | Purpose |
|---|---|---|
models/ |
/workspace/stable-diffusion-webui/models |
Base models and checkpoints |
outputs/ |
/workspace/stable-diffusion-webui/outputs |
Generated images |
extensions/ |
/workspace/stable-diffusion-webui/extensions |
Installed extensions |
embeddings/ |
/workspace/stable-diffusion-webui/embeddings |
Textual inversion embeddings |
logs/ |
/workspace/stable-diffusion-webui/logs |
Runtime logs |
cache/ |
/workspace/stable-diffusion-webui/cache |
HuggingFace and UI cache |
pip-cache/ |
/workspace/stable-diffusion-webui/pip-cache |
Pip download cache |
UI state is persisted as individual files in the repo root: config.json, ui-config.json, and styles.csv.
Everything else — the Python environment, A1111 itself, and its sub-repositories — lives inside the image. Rebuilding or updating the image never touches your persistent data.
Any extensions installed via the WebUI (e.g., ADetailer) will persist across restarts. They are stored in the extensions/ folder and mounted into the container. Their Python dependencies install into the container on first start after a rebuild; the mounted pip-cache/ keeps that fast.
The image builds AUTOMATIC1111 at a pinned release (v1.10.1) rather than whatever master happens to be that day, so builds are reproducible. To try a different release:
docker compose build --build-arg A1111_VERSION=v1.10.0or edit A1111_VERSION in the Dockerfile.
Note: Stability-AI deleted their original
stablediffusionrepository from GitHub, which broke older versions of this project (and stock A1111 installs). The image now clones a fork that preserves the exact commit A1111 expects.
To pre-load model downloads before first launch:
mkdir -p ~/a1111-docker/models/Stable-diffusion
wget -O ~/a1111-docker/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensorsStart:
docker compose up -dStop:
docker compose downWatch logs:
docker compose logs -fRunning bash setup.sh again is always safe — it re-verifies folders and configs before starting.
cd ~/a1111-docker
git pull
bash setup.sh --pullThis picks up the latest published image (or, without --pull, rebuilds only the layers that changed). Your models, outputs, and settings are untouched.
If you're troubleshooting a broken build, force a clean one:
bash setup.sh --no-cache