hf jobs exposes container ports through the jobs proxy
Introduced 2026-06-11 · score 0.98
HOW TO USE IT
When a repository development server runs in an HF Job, pass its port with `--expose` or `expose` when creating the job. Use the returned `expose_urls` to reach it; accessing the URL requires an HF token with read access to the job's namespace.
hf jobs run --expose 8000 python:3.12 python -m http.server 8000from huggingface_hub import run_job
job = run_job(image="python:3.12", command=["python", "-m", "http.server", "8000"], expose=[8000])
job.status.expose_urlsWHY THIS HELPS
Run a repository development server in a Hugging Face Job and make its port reachable for review.
REQUIREMENTS AND LIMITATIONS
- Version: v1.19.0
- --expose INTEGER: Container port to expose through the jobs proxy; repeat the flag to expose multiple ports. URL access requires an HF token with read access to the job's namespace.
- image (required): Docker image for the job; example uses `python:3.12`.
- command (required): Command to run in the job; example starts Python's HTTP server on port 8000.
- expose: List of container ports to expose through the proxy, e.g. `[8000]`.
- JobStatus.expose_urls: List of public URLs for exposed ports; `None` when no port is exposed. Each URL uses `https://<job_id>--<port>.hf.jobs`. Access requires an HF token with read access to the job's namespace.
- Prerequisite: The machine must be logged in to run and manage Jobs.
- Prerequisite: Jobs are available to Pro users and Team or Enterprise organizations.
- Prerequisite: Accessing an exposed URL requires an HF token with read access to the Job's namespace.
- Exposed ports require an HF token with read access to the job's namespace.
- Works on `hf jobs run`, `hf jobs uv run`, and their scheduled variants.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.19.0
- https://huggingface.co/docs/huggingface_hub/v1.19.0/en/guides/jobs
- https://huggingface.co/docs/huggingface_hub/v1.19.0/en/package_reference/jobs
Check the installed version and the source before using it. Entry JSON