-
Notifications
You must be signed in to change notification settings - Fork 146
Docker Guide
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.
Nvidia GPU that supports CUDA 11.3+ Docker and docker compose v2+ nvidia-container-toolkit
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
- Follow the guide to install Docker Desktop WSL 2 backend
- Verify gpu support by opening WSL and running
nvidia-smi
in the command line
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.
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.
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.