Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Docker: drop the baked uv cache from the Studio image and correct its labels and Hub page (#10827)

oobabooga6b36c8e67297
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index ae5c2c51ff3..dab5a487b6a 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -253,6 +253,9 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ # The action copies the repo's Apache-2.0, but both images ship Studio (AGPL-3.0) too.
+ labels: |
+ org.opencontainers.image.licenses=Apache-2.0 AND AGPL-3.0-only
- name: Build and push (per-arch by digest)
id: build
@@ -444,6 +447,9 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ # The action copies the repo's Apache-2.0, but both images ship Studio (AGPL-3.0) too.
+ labels: |
+ org.opencontainers.image.licenses=Apache-2.0 AND AGPL-3.0-only
- name: Build and push (per-arch by digest)
id: build
diff --git a/docker/DOCKERHUB.md b/docker/DOCKERHUB.md
index b51841f2a89..dfe5863bc55 100644
--- a/docker/DOCKERHUB.md
+++ b/docker/DOCKERHUB.md
@@ -1,6 +1,6 @@
# Unsloth Docker Image
-Pre-built images for [Unsloth](https://github.com/unslothai/unsloth): fine-tune and run LLMs, vision, audio and diffusion models with no setup. Every image carries the full training stack (PyTorch 2.11 with CUDA 12.8, Unsloth, unsloth-zoo, bitsandbytes, TRL, PEFT, plus xformers on `linux/amd64`), JupyterLab with the [Unsloth notebooks](https://github.com/unslothai/notebooks) pre-synced, and prebuilt llama.cpp and whisper.cpp for GGUF work.
+Pre-built images for [Unsloth](https://github.com/unslothai/unsloth): fine-tune and run LLMs, vision, audio and diffusion models with no setup. Every image carries the full training stack (PyTorch 2.11 with CUDA 12.8, Unsloth, unsloth-zoo, bitsandbytes, TRL, PEFT, plus xformers on `linux/amd64`), JupyterLab with the [Unsloth notebooks](https://github.com/unslothai/notebooks) pre-synced, and prebuilt llama.cpp for GGUF work. The `latest` image adds whisper.cpp for Studio's speech-to-text.
Source: [`docker/`](https://github.com/unslothai/unsloth/tree/main/docker) in the main repository. Guide: [docs.unsloth.ai](https://docs.unsloth.ai/get-started/install/docker).
@@ -103,7 +103,8 @@ Turing has no bfloat16; Unsloth falls back to float16 there. AMD GPUs are not su
| `SSH_KEY` or `PUBLIC_KEY` | OpenSSH public key for root login. Enables sshd on port 22. Password login is never enabled. |
| `UNSLOTH_ALLOW_CPU=1` | Allow starting without a GPU (`latest` already does). Dropped when a GPU is visible, where it would turn off Unsloth's training patches. |
| `UNSLOTH_JUPYTER_CLOUDFLARE=1` | Publish JupyterLab through a Cloudflare quick tunnel and print the URL. |
-| `UNSLOTH_SKIP_NOTEBOOK_SYNC=1` | Do not refresh the notebooks from GitHub on start. |
+| `UNSLOTH_SKIP_NOTEBOOK_REFRESH=1` | Do not refresh the notebooks from GitHub on start; the copy baked into the image is still used. |
+| `UNSLOTH_SKIP_NOTEBOOK_SYNC=1` | Do not set up the notebooks at all: nothing is created at `/workspace/unsloth-notebooks` or `/workspace/Unsloth Notebooks` (copies left there by an earlier start on a mounted `/workspace` stay as they are). |
| `HF_TOKEN`, `WANDB_API_KEY` | Forwarded to Hugging Face and Weights and Biases. |
On a host with no GPU, Studio, JupyterLab and its kernels, and login shells all run in
@@ -123,7 +124,7 @@ The working directory is `/workspace`. Mount what you want to keep:
| `/workspace/unsloth-notebooks` | The synced notebooks. Your edits are kept across refreshes. |
| `/workspace/Unsloth Notebooks` | The same notebooks grouped by topic, rebuilt on each start. |
-The container runs as root by default. `--user <uid>:<gid>` is supported and keeps files on your mounts owned by you.
+The container runs as root by default. On `core`, `--user <uid>:<gid>` is supported and keeps files on your mounts owned by you. `latest` runs its services as root and does not start under `--user`.
## Updating inside a running container
@@ -133,7 +134,9 @@ On the `latest` image:
- `unsloth-llama-update` fetches the newest prebuilt llama.cpp.
- `unsloth-jupyter-tunnel` opens a Cloudflare quick tunnel to JupyterLab.
-On both images the notebooks refresh from GitHub on each start unless `UNSLOTH_SKIP_NOTEBOOK_SYNC=1`. Pull a new image tag to update everything else.
+On both images the notebooks refresh from GitHub on each start unless `UNSLOTH_SKIP_NOTEBOOK_REFRESH=1`. Pull a new image tag to update everything else.
+
+Setting them up costs roughly 10 to 20 seconds of every start, depending on the disk, so a one-shot `docker run --rm ... python script.py` is worth running with `UNSLOTH_SKIP_NOTEBOOK_SYNC=1`.
## Help
@@ -143,4 +146,4 @@ On both images the notebooks refresh from GitHub on each start unless `UNSLOTH_S
## License
-AGPL-3.0, following the main repository. See [LICENSE](https://github.com/unslothai/unsloth/blob/main/LICENSE).
+Unsloth is Apache-2.0 ([LICENSE](https://github.com/unslothai/unsloth/blob/main/LICENSE)). Both images also include Unsloth Studio's code (`studio/`), which is AGPL-3.0 ([studio/LICENSE.AGPL-3.0](https://github.com/unslothai/unsloth/blob/main/studio/LICENSE.AGPL-3.0)).
diff --git a/docker/Dockerfile.studio b/docker/Dockerfile.studio
index 54e747a7a51..78dd1f8836a 100644
--- a/docker/Dockerfile.studio
+++ b/docker/Dockerfile.studio
@@ -78,6 +78,9 @@ RUN apt-get update \
# build time would land on cpu/cu126). cu128 on both arches, mirroring the base.
# Blackwell JIT (sm_103/sm_121) comes from the same cu13 NVRTC swap, repeated below.
#
+# install.sh's uv cache sits under $UNSLOTH_STUDIO_HOME/cache/uv (or $UV_CACHE_DIR), not
+# /root/.cache, so it is removed by path below; the venv's hardlinks survive, the rest is dead.
+#
# UNSLOTH_PYTHON=3.12 pins the Studio venv to the base's Python minor so the
# nvidia-*-cu12 wheels are byte-identical and the dedup below can symlink them.
#
@@ -124,6 +127,7 @@ RUN set -eux \
&& echo "OK: Studio kept the base image's CUDA llama.cpp bundle" \
&& rm -rf "${UNSLOTH_STUDIO_HOME}/src/.git" \
"${UNSLOTH_STUDIO_HOME}/src/studio/frontend/node_modules" \
+ "${UV_CACHE_DIR:-${UNSLOTH_STUDIO_HOME}/cache/uv}" \
/root/.cache \
# Stage the Studio venv's NVRTC like the base (.cu128.orig default + .cu13
# alias, retargeted per device by select_cuda_jit_tools). Both arches.
diff --git a/tests/python/test_docker_hub_readme.py b/tests/python/test_docker_hub_readme.py
index b66156ad4d0..ede4f6ccdfb 100644
--- a/tests/python/test_docker_hub_readme.py
+++ b/tests/python/test_docker_hub_readme.py
@@ -163,3 +163,30 @@ def test_the_sync_fails_without_a_token(sync_job: dict, tmp_path: Path):
res, log = _run_sync(step, tmp_path, live_after_patch = "", token = "")
assert res.returncode != 0
assert "PATCH" not in log, "a PATCH was attempted with an empty token"
+
+
+def test_the_hub_readme_matches_what_each_image_ships():
+ text = HUB_README.read_text(encoding = "utf-8")
+ # whisper.cpp comes from Studio's setup, so only that image has it
+ assert "The `latest` image adds whisper.cpp" in text
+ # SYNC disables the notebooks entirely; REFRESH only skips the GitHub fetch
+ assert "`UNSLOTH_SKIP_NOTEBOOK_REFRESH=1` | Do not refresh the notebooks from GitHub" in text
+ assert "`UNSLOTH_SKIP_NOTEBOOK_SYNC=1` | Do not set up the notebooks at all" in text
+ # Studio's services run as root and exit 1 under --user
+ assert "On `core`, `--user <uid>:<gid>` is supported" in text
+ assert "AGPL-3.0" in text and "Apache-2.0" in text
+
+
+def test_both_images_declare_both_licenses():
+ """metadata-action labels both images Apache-2.0, but they carry Studio's AGPL-3.0 code."""
+ text = WORKFLOW.read_text(encoding = "utf-8")
+ assert text.count("org.opencontainers.image.licenses=Apache-2.0 AND AGPL-3.0-only") == 2
+
+
+def test_the_studio_image_does_not_ship_the_uv_download_cache():
+ """install.sh's uv cache sits under the Studio home, which /root/.cache never reached: ~9 GB baked into :latest."""
+ body = (REPO_ROOT / "docker" / "Dockerfile.studio").read_text(encoding = "utf-8")
+ # an image that points uv elsewhere (the code/data split does) must drop that cache
+ assert "rm -rf" in body
+ cleanup = body[body.index("rm -rf") :]
+ assert '"${UV_CACHE_DIR:-${UNSLOTH_STUDIO_HOME}/cache/uv}"' in cleanup