{"id":15679821,"url":"https://github.com/jim60105/docker-stable-diffusion-webui","last_synced_at":"2025-05-07T02:44:21.205Z","repository":{"id":226659304,"uuid":"768702539","full_name":"jim60105/docker-stable-diffusion-webui","owner":"jim60105","description":"Dockerfile for stable-diffusion-webui with the goal of keeping it small and follow best practices. (Dockerfile, CI image build)","archived":false,"fork":false,"pushed_at":"2025-02-20T13:52:30.000Z","size":177,"stargazers_count":29,"open_issues_count":2,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T05:33:19.796Z","etag":null,"topics":["docker-image","dockerfile","stable-diffusion","stable-diffusion-webui"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jim60105.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-07T15:20:57.000Z","updated_at":"2025-03-19T07:39:03.000Z","dependencies_parsed_at":"2024-03-17T09:29:13.213Z","dependency_job_id":"723bc0b8-f687-41a0-806d-7cfbad68b99d","html_url":"https://github.com/jim60105/docker-stable-diffusion-webui","commit_stats":{"total_commits":104,"total_committers":2,"mean_commits":52.0,"dds":0.009615384615384581,"last_synced_commit":"25af8b55d5c61d739a910e31488d9789c4c03948"},"previous_names":["jim60105/docker-stable-diffusion-webui"],"tags_count":9,"template":false,"template_full_name":"jim60105/Containerfile-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-stable-diffusion-webui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-stable-diffusion-webui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-stable-diffusion-webui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-stable-diffusion-webui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jim60105","download_url":"https://codeload.github.com/jim60105/docker-stable-diffusion-webui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246558075,"owners_count":20796696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","dockerfile","stable-diffusion","stable-diffusion-webui"],"created_at":"2024-10-03T16:37:31.621Z","updated_at":"2025-03-31T23:31:51.096Z","avatar_url":"https://github.com/jim60105.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-stable-diffusion-webui\n\n\u003csection align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/jim60105/docker-stable-diffusion-webui/assets/16995691/de246026-c7b5-474e-bade-89905aa5b010\"/\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/jim60105/docker-stable-diffusion-webui/blob/master/README.zh.md\"\u003e\n        中文\n    \u003c/a\u003e\n    \u003cspan\u003e| English\u003c/span\u003e\n  \u003c/p\u003e\n\u003c/section\u003e\n\n[![CodeFactor](https://www.codefactor.io/repository/github/jim60105/docker-stable-diffusion-webui/badge)](https://www.codefactor.io/repository/github/jim60105/docker-stable-diffusion-webui) [![DeepSource](https://app.deepsource.com/gh/jim60105/docker-stable-diffusion-webui.svg/?label=active+issues\u0026show_trend=false\u0026token=1VuQPvmy4vSxN83egASazDLW)](https://app.deepsource.com/gh/jim60105/docker-stable-diffusion-webui/) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/jim60105/docker-stable-diffusion-webui/docker_publish.yml?label=DOCKER%20BUILD)\n\nYet another docker image for [AUTOMATIC1111/Stable Diffusion web UI: A web interface for Stable Diffusion, implemented using Gradio library.](https://github.com/AUTOMATIC1111/stable-diffusion-webui) from the community.\n\nThe main goal of designing this image is to keep it ***small and follow best practices***. Successfully controlled the size to around **10GB**, saving approximately **1/3** of the capacity compared to other existing solutions.\n\nThis makes it possible for me to consistently automate building images by using the [CI workflow](https://github.com/jim60105/docker-stable-diffusion-webui/actions/workflows/docker_publish.yml) on GitHub free runner. You can pull the [pre-built images](https://ghcr.io/jim60105/stable-diffusion-webui) from ghcr, saving time instead of constructing them yourself!\n\nGet the Dockerfile at [GitHub](https://github.com/jim60105/docker-stable-diffusion-webui), or pull the image from [ghcr.io](https://ghcr.io/jim60105/stable-diffusion-webui).\n\n## 🚀 Get your Docker ready for GPU support\n\n### Windows\n\nOnce you have installed [**Docker Desktop**](https://www.docker.com/products/docker-desktop/), [**CUDA Toolkit**](https://developer.nvidia.com/cuda-downloads), [**NVIDIA Windows Driver**](https://www.nvidia.com.tw/Download/index.aspx), and ensured that your Docker is running with [**WSL2**](https://docs.docker.com/desktop/wsl/#turn-on-docker-desktop-wsl-2), you are ready to go.\n\nHere is the official documentation for further reference.  \n\u003chttps://docs.nvidia.com/cuda/wsl-user-guide/index.html#nvidia-compute-software-support-on-wsl-2\u003e\n\u003chttps://docs.docker.com/desktop/wsl/use-wsl/#gpu-support\u003e\n\n### Linux, OSX\n\nInstall an NVIDIA GPU Driver if you do not already have one installed.  \n\u003chttps://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html\u003e\n\nInstall the NVIDIA Container Toolkit with this guide.  \n\u003chttps://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html\u003e\n\n## 🖥️ Run the project\n\n1. Clone the repository to your local machine and navigate to the directory.\n\n    ```bash\n    git clone https://github.com/jim60105/docker-stable-diffusion-webui.git\n    cd docker-stable-diffusion-webui\n    ```\n\n2. Compose up the service and wait for startup loading.\n\n    ```bash\n    docker compose up -d\n    ```\n\n3. Access the web UI at [http://localhost:7860](http://localhost:7860).  \n    (Browser won't be started automatically!)\n\nModels and settings will be stored at directory `./data`.  \nOutput images will be stored at directory `./data/output` for default.\n\n## 🔀 Switch between different versions/branches\n\n### Docker Image Tags\n\nThe docker image tag corresponds to the non-RC version number from `v1.6.1` and its `dev` branch in [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui). The `dev` image rebuilds weekly to keep up with the latest changes.\n\n| Image tag    | Code version                                                                                                             |\n|--------------|--------------------------------------------------------------------------------------------------------------------------|\n| dev (latest) | [AUTOMATIC1111/stable-diffusion-webui dev branch](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/dev)      |\n| v1.6.1       | [AUTOMATIC1111/stable-diffusion-webui v1.6.1 tag](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.6.1)   |\n| v1.7.0       | [AUTOMATIC1111/stable-diffusion-webui v1.7.0 tag](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.7.0)   |\n| v1.8.0       | [AUTOMATIC1111/stable-diffusion-webui v1.8.0 tag](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.8.0)   |\n| v1.9.4       | [AUTOMATIC1111/stable-diffusion-webui v1.9.4 tag](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.9.4)   |\n| v1.10.1      | [AUTOMATIC1111/stable-diffusion-webui v1.10.1 tag](https://github.com/AUTOMATIC1111/stable-diffusion-webui/tree/v1.10.1) |\n\nYou can check all available tags at [ghcr.io](https://github.com/jim60105/docker-stable-diffusion-webui/pkgs/container/stable-diffusion-webui).\n\n### Specify the image in the docker-compose.yml\n\nChange the tag after `ghcr.io/jim60105/stable-diffusion-webui` in the [`image` field of `docker-compose.yml`](https://github.com/jim60105/docker-stable-diffusion-webui/blob/75e84ec718572b793a8cf20f198a2ddd066a7bc2/docker-compose.yml#L4) to your desired version.\n\nFor example, if you want to use the `v1.8.0` version, you should modify it to:\n\n```yml\nimage: ghcr.io/jim60105/stable-diffusion-webui:v1.8.0\n```\n\nThen restart the service using the following command:\n\n```bash\ndocker compose down \u0026\u0026 docker compose up -d\n```\n\n### Use the forge version\n\nThere's a special version `forge` which is based on the `main` branch of [lllyasviel/stable-diffusion-webui-forge](https://github.com/lllyasviel/stable-diffusion-webui-forge). The `forge` image rebuilds weekly to keep up with the latest changes.\n\n| Image tag      | Code version                                                                                                                     |\n|----------------|----------------------------------------------------------------------------------------------------------------------------------|\n| forge          | [lllyasviel/stable-diffusion-webui-forge main branch](https://github.com/lllyasviel/stable-diffusion-webui-forge/tree/main)      |\n| forge-previous | [lllyasviel/stable-diffusion-webui-forge previous tag](https://github.com/lllyasviel/stable-diffusion-webui-forge/tree/previous) |\n\nYou can use it with the `docker-compose.forge.yml` file.\n\n```bash\ndocker compose -f docker-compose.forge.yml up -d\n```\n\n\u003e [!NOTE]  \n\u003e Notice that they used the same port `7860`, so you can't run them at the same time.  \n\u003e Please stop the running service before starting another one.  \n\u003e ![image](https://github.com/jim60105/docker-stable-diffusion-webui/assets/16995691/f7aecb66-5416-4806-90d8-b6c6be6c1bad)\n\n### `runtime-deps` images\n\n\u003e [!NOTE]  \n\u003e You can build it locally with Docker build arguments: `SKIP_REQUIREMENTS_INSTALL=true`\n\nSome recent versions have `runtime-deps` images that you can use, like `v1.8.0-runtime-deps`, `v1.9.4-runtime-deps`, and `forge-runtime-deps`.\n\nThese images does not include pre-installed pip requirements.  \nInstead, the requirements will be installed during the image first launch.\n\nThe initial startup process may take some time, but this leads to a smaller image size of **1.3GB**!\n\nConsider using them if they fit your needs.\n\n\u003e [!TIP]  \n\u003e This image can be used in a tricky way: to preserve and reuse the `/home/1001/.local` directory through a volume.  \n\u003e It's like sharing the same environment across different Python applications.  \n\u003e I wouldn't recommend this approach for regular users... you must be fully aware of what you're doing.  \n\u003e As for power users, please refer to [this commit](https://github.com/jim60105/docker-stable-diffusion-webui/commit/c46ddadee56c0afe0fc71cf1157ad4a6f3eefe65) for more information.  \n\u003e Thanks to the community for coming up with this amazing idea!😆\n\n## 🛠️ Build instructions\n\n\u003e [!IMPORTANT]  \n\u003e Clone the Git repository ***recursively*** to include submodules:  \n\u003e `git clone --recursive https://github.com/jim60105/docker-stable-diffusion-webui.git`\n\n```bash\ndocker compose up -d --build\n```\n\n\u003e [!NOTE]  \n\u003e If you are using an earlier version of the docker client, it is necessary to [enable the BuildKit mode](https://docs.docker.com/build/buildkit/#getting-started) when building the image. This is because I used the `COPY --link` feature which enhances the build performance and was introduced in Buildx v0.8.  \n\u003e With the Docker Engine 23.0 and Docker Desktop 4.19, Buildx has become the default build client. So you won't have to worry about this when using the latest version.\n\n## 🔄 Migrate from existing settings\n\n1. Edit your existing `config.json` and modify all paths to be under `/data`, for example:\n\n    ```json\n    {\n        \"outdir_samples\": \"\",\n        \"outdir_txt2img_samples\": \"/data/output/txt2img-images\",\n        \"outdir_img2img_samples\": \"/data/output/img2img-images\",\n        \"outdir_extras_samples\": \"/data/output/extras-images\",\n        \"outdir_grids\": \"\",\n        \"outdir_txt2img_grids\": \"/data/output/txt2img-grids\",\n        \"outdir_img2img_grids\": \"/data/output/img2img-grids\",\n        \"outdir_save\": \"/data/log/images\",\n        \"outdir_init_images\": \"/data/output/init-images\",\n    }\n    ```\n\n2. Place `config.json` under the `data` directory.\n3. Put the models and other existing data into corresponding folders under `data`.\n4. ***Please correct the permissions of all the files in the `data` folder***:\n\n    ```sh\n    docker run -v \".:/app\" -it busybox sh -c \"chown -R 1001:0 /app/data \u0026\u0026 chmod -R 775 /app/data\"\n    ```\n\n\u003e [!NOTE]  \n\u003e This instruction uses busybox to change the owner group of the `data` directory to ***0 (root group)*** and grants ***write permission to the group***. This aligns with OpenShift best practices by ***supporting arbitrary uid***.\n\n\u003e [!WARNING]  \n\u003e This image follows best practices by ***using non-root user*** and ***restricting write permissions to non-essential folders***. You may not be able to store files outside the `/data` path unless appropriate modifications have been made.\n\n## 📝 LICENSE\n\n\u003e [!NOTE]  \n\u003e The main program, [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), is distributed under [AGPL-3.0 license](https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/LICENSE.txt).  \n\u003e Please consult their repository for access to the source code and licenses.  \n\u003e The following is the license for the Dockerfiles and CI workflows in this repository.\n\n\u003cimg src=\"https://github.com/jim60105/docker-stable-diffusion-webui/assets/16995691/a12d2791-048f-4b8d-87f8-96c88c9ef310\" alt=\"agplv3\" width=\"300\" /\u003e\n\n[GNU AFFERO GENERAL PUBLIC LICENSE Version 3](/LICENSE)\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along with this program. If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n\n\u003e [!CAUTION]  \n\u003e An AGPLv3 licensed Dockerfile means that you ***MUST*** **distribute the source code with the same license**, if you\n\u003e\n\u003e - Re-distribute the image. (You can simply point to this GitHub repository if you doesn't made any code changes.)\n\u003e - Distribute a image that uses code from this repository.\n\u003e - Or **distribute a image based on this image**. (`FROM ghcr.io/jim60105/stable-diffusion-webui` in your Dockerfile)\n\u003e\n\u003e \"Distribute\" means to make the image available for other people to download, usually by pushing it to a public registry. If you are solely using it for your personal purposes, this has no impact on you.\n\u003e\n\u003e Please consult the [LICENSE](LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim60105%2Fdocker-stable-diffusion-webui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjim60105%2Fdocker-stable-diffusion-webui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim60105%2Fdocker-stable-diffusion-webui/lists"}