Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Docker Guide

Christoffer Olofsson edited this page Aug 29, 2022 · 2 revisions

Overview

The current implementation is intended to create the bare minimum environment to run the code in the repository. Minimal information is baked into the image to allow for easy updates without rebuilding.

The Dockerfile will create an image on your system that has Nvidia drivers, CUDA and Miniconda installed. The entrypoint.sh script handles the remaining requirements of the application such as installing the conda env, downloading required model files and launching the webgui when the container is started.

2 volumes are created to cache the conda and pip dependencies and reduce needing to recreate/download them on container restarts/rebuilds.

The code from the repository is mounted in the container at /sd. Image output will be found in ./outputs on your system as expected.

Requirements

Nvidia GPU that supports CUDA 11.3+ Docker and docker compose v2+ nvidia-container-toolkit

Setup

git clone https://github.com/hlky/stable-diffusion.git
cd stable-diffusion
docker compose up

Initial installation will take some time, probably 10-20 mins depending on your system and internet connection.

You can stop the container with CTRL-C and restart it later by simply running docker compose up

Windows Setup (WIP*)

Make sure that your git is not converted newlines into Windows format differently from the repository

git config core.autocrlf false
git reset --hard HEAD

* Please comment if you got everything running successfully and any special steps needed.

Updating

docker compose down
git pull
docker compose up --build

This will only rebuild layers that have changed in the Dockerfile. Other environment changes should be handled by entrypoint.sh and then any new code for the webgui will be launched.

Troubleshooting

A helper script has been provided to clean the docker environment of the container, image and volumes. Please inspect docker-reset.sh for the relevant commands in bash if you need to recreate the steps on another OS.

Clone this wiki locally