Skip to content

Docker publish: verify the Studio image env, and stop telling latest users to opt in to CPU - #11071

Merged
danielhanchen merged 3 commits into
mainfrom
docker/studio-ships-entrypoint
Sep 16, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
docker/studio-ships-entrypoint

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Two follow-ups to #10825, which moved the Studio image off an image-wide UNSLOTH_ALLOW_CPU=1 and onto UNSLOTH_IMAGE_ALLOW_CPU=1 that entrypoint.sh translates per container.

The artifact was never checked

An image-wide UNSLOTH_ALLOW_CPU reaches every process in the container and turns off Unsloth's TRL trainer patches on GPU hosts, which is why #10825 moved away from it. The unit tests pin the Dockerfile text, and the smoke-test job that would catch it on the real artifact needs a self-hosted GPU runner. This repository has none: repos/unslothai/unsloth/actions/runners returns total_count: 0, so that job has never run and cannot.

build-studio now reads the pushed digest's config with docker buildx imagetools inspect and fails when the env carries UNSLOTH_ALLOW_CPU or is missing the UNSLOTH_IMAGE_ALLOW_CPU=1 opt-in. It needs no GPU and runs in the job that produced the digest.

Checked against what is published today:

$ docker run --rm --entrypoint bash unsloth/unsloth:latest -lc 'env | grep UNSLOTH.*ALLOW_CPU'
UNSLOTH_IMAGE_ALLOW_CPU=1

So the assertion passes on the current image and would have failed on the pre-#10825 one.

The Hub page contradicts itself

docker/DOCKERHUB.md still says "Without a GPU the container refuses to start unless you opt in" and shows latest being run with -e UNSLOTH_ALLOW_CPU=1, while its own environment table three sections later says latest already starts without a GPU. Since #10825 the table is right and the paragraph is wrong. The paragraph now distinguishes the two images: latest starts on a CPU-only host by itself, core needs the opt-in.

This matters beyond tidiness: following the old example sets the variable image-wide on a machine that may well have a GPU, which is the exact configuration #10825 removed.

Also

A test pins that Dockerfile.studio copies entrypoint.sh to the base's path and declares no ENTRYPOINT of its own, so the two images cannot drift apart again.

Verification

  • tests/python/test_docker_cpu_fallback.py: 32 passed.
  • The workflow parses, and actionlint reports the same 6 pre-existing findings as on main.
  • The env assertion was run by hand against the published unsloth/unsloth:latest as shown above.

…training, and stop telling latest users to opt in to CPU

#10825 moved the Studio image from an image-wide UNSLOTH_ALLOW_CPU=1 to
UNSLOTH_IMAGE_ALLOW_CPU=1 that the entrypoint translates per container. The unit tests
pin the Dockerfile text; nothing checked the artifact, and the publish smoke-test job
needs a GPU runner this repo does not have. build-studio now reads the pushed digest's
config with imagetools and fails when UNSLOTH_ALLOW_CPU is in the env or the opt-in is
missing.

DOCKERHUB.md still told CPU-only users to pass -e UNSLOTH_ALLOW_CPU=1 to latest, which
starts on CPU by itself since #10825; the example now shows latest plain and core with
the opt-in. A test pins that Dockerfile.studio copies entrypoint.sh to the base's path
and declares no ENTRYPOINT of its own.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T05:29:19.527749Z c8c7782 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17d7dbced6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +285 to +287
assert dest == ["/usr/local/bin/unsloth-entrypoint"], dest
assert re.findall(r"^COPY\s+entrypoint\.sh\s+(\S+)\s*$", studio, re.M) == dest
assert not re.search(r"^\s*ENTRYPOINT\b", studio, re.M), (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert the base ENTRYPOINT directive

This compares only the COPY destination and never verifies the base Dockerfile's actual ENTRYPOINT. If a later base edit removes or redirects that directive while retaining the copy, this test still passes even though Dockerfile.studio declares no replacement, so the entrypoint that translates UNSLOTH_IMAGE_ALLOW_CPU would no longer run. Assert that the base contains the exact expected ENTRYPOINT target as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the copy destination alone did not prove the base still runs that file. Fixed in c8c7782: the test now asserts the base declares ENTRYPOINT ["/usr/local/bin/unsloth-entrypoint"] exactly, so dropping or redirecting it fails here rather than silently leaving nothing to translate UNSLOTH_IMAGE_ALLOW_CPU.

pre-commit-ci Bot and others added 2 commits September 16, 2026 04:17
The COPY destination alone does not prove the base still runs that file:
a later base edit could drop or redirect ENTRYPOINT while keeping the
copy, and the test would still pass even though nothing would translate
UNSLOTH_IMAGE_ALLOW_CPU.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 16, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: c8c7782b6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 16, 2026
@danielhanchen
danielhanchen merged commit 87cb503 into main Sep 16, 2026
16 of 18 checks passed
@danielhanchen
danielhanchen deleted the docker/studio-ships-entrypoint branch September 16, 2026 07:00
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…users to opt in to CPU (unslothai#11071)

The Studio image turns UNSLOTH_IMAGE_ALLOW_CPU into UNSLOTH_ALLOW_CPU inside the entrypoint, so a plain image ENV of UNSLOTH_ALLOW_CPU would reach every process and disable training on a GPU host. Nothing checked that at publish time.

- build-studio now inspects the pushed image with buildx imagetools and fails when UNSLOTH_ALLOW_CPU is present in the image env, or when UNSLOTH_IMAGE_ALLOW_CPU=1 is missing.
- docker/DOCKERHUB.md no longer tells latest users to pass UNSLOTH_ALLOW_CPU=1; the image already defaults it, and the env table said as much, so the two contradicted each other.
- tests/python/test_docker_cpu_fallback.py asserts the Studio image bundles its own entrypoint at the base's path, declares no ENTRYPOINT of its own, and that the base still runs that file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant