Hugging Face Now Hosts Container Images: What AI Developers Should Know

Hugging Face Now Hosts Container Images: What AI Developers Should Know

●1 ●22 ●87
calendar_today ago • schedule6 min read

By Mahan Kenway

Hugging Face has added a new place to put the software that runs an AI project, not just the model itself. Its December 4 changelog says users can now enable Container Repos and host Docker and other OCI images on the Hub, served from cr.hf.co alongside models, datasets, and Spaces.

That sounds like a small infrastructure update. For developers who publish inference servers, reproducible demos, or training environments, it closes a practical gap: the model and the container needed to run the application can now be discoverable under the same platform and access-control system. You still need to decide what goes into the image, manage model access, and secure the software supply chain. A container repository is a registry, not a service that automatically runs your model.

Cover: Original conceptual illustration created for this article.

What actually changed?

Container Repos are a separate repository type for Open Container Initiative (OCI) images. Each gets a Hub page listing its tags, while image pulls and pushes use the cr.hf.co registry. Hugging Face says the registry supports standard clients including Docker and Podman, as well as Kubernetes and tools for image signatures and software bills of materials. The underlying storage uses Xet, Hugging Face's storage backend. Source: Container Repos documentation

To turn the feature on, users enable it in personal account settings; organization admins can enable it in their organization's settings. You then create a container repository through the Hub or CLI. Critically, create the repository before the first push: the documentation says pushing to a repository that does not exist returns NAME_UNKNOWN.

This is distinct from a model repository or a Space. A container image is a packaged filesystem and configuration for running software; a model repository can hold model weights and related files. Putting them near each other can simplify discovery and permissions, but it does not automatically put the model weights in the image, make gated weights publicly usable, or guarantee that two artifacts stay in sync.

A minimal Docker workflow

Suppose you have already built an image called my-app:local. First enable Container Repos and create a repository named my-app under your personal or organization namespace. Choose its visibility deliberately. Then, replacing the placeholders with your real lowercase namespace and Hugging Face username:

# HF_TOKEN should contain a Hugging Face token with permission to push.
printf '%s' "$HF_TOKEN" | docker login cr.hf.co \
  -u YOUR_HF_USERNAME --password-stdin

docker tag my-app:local cr.hf.co/your-namespace/my-app:v1
docker push cr.hf.co/your-namespace/my-app:v1

# On a machine with permission to access the repository:
docker pull cr.hf.co/your-namespace/my-app:v1

The official guide uses the Hugging Face username and a user access token for Docker login. A write token is needed for pushing, while a read token can pull where the account has access. Public images can be pulled without logging in. Treat the token as a secret: avoid committing it to a Dockerfile, repository, or build log.

The registry name must have the form cr.hf.co/<namespace>/<name> and be lowercase. The repository page is available at https://huggingface.co/containers/<namespace>/<name>. A tag is convenient, but it can move; if a deployment depends on an exact image, pin its digest and keep a tag pointing to the image, for reasons covered below.

The optional CLI trades smaller uploads for larger stored layers

Docker isn't the only route. Hugging Face also provides hf containers, an extension of the hf CLI:

hf extensions install hf-containers
hf auth login

# Create a private repo once, after enabling Container Repos.
hf containers create your-namespace/my-app --private

# Tag and push an image already in your Docker image store.
hf containers tag my-app:local cr.hf.co/your-namespace/my-app:v1
hf containers push cr.hf.co/your-namespace/my-app:v1

The client requires Docker with the containerd image store, on Linux or macOS. The project's README says Windows and Docker's classic image store are not supported by the client, except that the copy operation does not require the containerd store. Ordinary OCI clients remain an alternative to the hf containers extension.

The performance idea is interesting, but it comes with a trade-off. By default, hf containers stores layers uncompressed, allowing Xet to reuse unchanged chunks between versions. Hugging Face's example describes rebuilding a 2 GB layer after changing 100 MB: if the remaining chunks can be reused, the upload might transfer roughly 100 MB. That's an illustration of possible deduplication, not a promised upload speed or savings. The rebuilt layer still counts at its uncompressed size for storage; a conventional Docker push stores compressed layers and may consume less space. Source: pricing and storage notes

Uncompressed layers also change image digests compared with a conventional Docker push. That matters if a deployment pins a digest or a signature refers to the original image. The documented hf containers push --preserve-digests option keeps those digests, but gives up the same chunk-level advantage for changed compressed layers. Check your signing and deployment workflow before switching push methods. Source: hf containers README

The extension can also copy an image from another registry without first pulling it into Docker. The destination repository must exist, and the default copy changes digests; --preserve-digests is available when keeping them matters. Before mirroring third-party images, check their license, redistribution terms, provenance, and any included model weights.

Visibility, automation, and cleanup matter

The access rules follow Hub visibility and roles: anyone can pull a public repository, while private repositories require authorized access; pushing requires a write role. Team and Enterprise organizations can use Resource Groups for more granular access. A private repository is not a substitute for reviewing who has access to its tokens or its organization. Source: access-control documentation

For GitHub Actions, Hugging Face documents a trusted-publisher option that exchanges a GitHub OIDC identity token for a short-lived Hub token scoped to the container repository. This can avoid storing a long-lived write token in the workflow. The documented token expires after 60 minutes; configure the trusted publisher in the repository settings before relying on it. Source: CI setup

There is also an easy-to-miss retention rule: untagged images are garbage-collected. If you overwrite a tag such as latest and no other tag points to the old image, the old image can be removed, even if you intended to pull it later by digest. Keep a stable tag on releases you need to retain. Removing a tag is not necessarily immediate deletion; the documentation says garbage collection removes the unreferenced image a few hours later.

Images count against the owner's Hub storage, and pulls count toward the plan's egress allowance. The storage documentation lists 100 GB of private storage for a free user or organization, while free public storage is best-effort rather than unlimited. Check your actual plan and current pricing before uploading large inference images. The container guide also lists a 100 GB maximum per layer and a 4 MiB maximum manifest size.

The practical takeaway

For an AI developer already using Hugging Face, this is a useful way to keep a runnable image closer to the model and dataset it accompanies without abandoning standard Docker tooling. It is especially relevant for small teams that want familiar Hub permissions and an automated build pipeline.

The best first experiment is a small private image: create the repository, push with your existing Docker workflow, pull it on a second machine, and check access and storage usage. If large rebuilds are eating bandwidth, test hf containers separately and compare its storage footprint and digest behavior before adopting it for production. As with any container registry, verify what you pull, avoid baking credentials into images, and keep the artifacts you need tagged.

Want more #ai & #devops deep dives?

Join 6,182+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

The cleanup failed on the night there was nothing to clean

BashSnippets - Dec 2

What Developers Already Know About Data Center Delays

Tom Smithverified - Sep 28

How AI Is Changing Web Development, and What Developers Still Need to Understand

Daniel Decker - Nov 10

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Free SEO Tools Every Small Business Should Use (2026) | FloxoLab

floxolab - Oct 20
chevron_left
2.6k Points • 110 Badges
77Posts
0Comments
4Connections
I'm a Developer and an avid Gamer. I love exploring the intersection of Artificial Intelligence, Cyb... Show more

Related Jobs

View all jobs →

Commenters (This Week)

7 comments
2 comments
2 comments

Contribute meaningful comments to climb the leaderboard and earn badges!