Hub documentation

Container Repos

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Container Repos

Container Repos are a repo type on the Hugging Face Hub for Docker and other OCI images, served by the Hugging Face container registry, cr.hf.co, and powered by the Xet storage backend. They live in your organization next to its models, datasets and Spaces.

Push and pull images with hf containers, the recommended client, or with Docker and any other OCI client, and browse their tags on the Hub.

To enable Container Repos, toggle the setting in your personal settings or your organization’s Account settings.

Images count toward your organization’s Hub storage. See Pricing for examples, and hf.co/storage for pricing details.

Why Host Containers on the Hub

  • Next to the rest of your work: images live in your organization, with the same members, roles, visibility and User Access Tokens as your other repos. There is no separate registry account to manage.
  • On your Hub storage: images count toward your organization’s storage, public or private, with no separate registry bill.
  • Served by the Hub’s CDN: layers are stored on Xet and served through the Hugging Face CDN wherever you run them, with egress included in your plan.
  • A standard registry: Docker, Podman, containerd and Kubernetes, crane, skopeo, ORAS, Helm and cosign work as they are, with multi-arch images and referrers (signatures, SBOMs and other artifacts attached to an image).
  • Faster with hf containers: the Hub’s own client uploads only the parts of a layer that changed since the previous version, and pulls layers straight from Xet with nothing to decompress.
  • Cleaned up for you: images that no tag points to are deleted automatically, so your storage follows what you tag.

Creating a Repository

From the Hub UI

  1. Navigate to huggingface.co/new-container.

  2. Specify the organization that owns the repository.

  3. Enter a repository name and, optionally, a short description.

  4. Choose whether the repository should be public or private.

From the CLI

With hf containers:

hf extensions install hf-containers
hf containers create my-org/my-app --private

Add --description for the short description shown on its page, --exist-ok to succeed when the repository already exists, and --resource-group-id to put it in a Resource Group.

From the API

curl -X POST https://huggingface.co/api/containers/my-org/my-app \
  -H "Authorization: Bearer $HF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"private": true}'

Create the repository before pushing: a push to a missing one fails with NAME_UNKNOWN. Who can pull and push follows the repository’s visibility and each member’s role in the organization, or in its Resource Group: see Access Control.

Browsing Images on the Hub

Every repository has a page on the Hub listing its tags, at https://huggingface.co/containers/<owner>/<name>.

As an example, see the official vLLM container page.

The vLLM container repository showing image tags, supported architectures, and a Docker pull command.

Pushing and Pulling with hf containers

hf containers, an extension of the hf CLI, is the recommended client. It stores layers uncompressed on Xet: a push only uploads the parts of each layer that changed since the previous version, and a pull downloads layers over many connections and unpacks them as they arrive, with nothing to decompress.

hf extensions install hf-containers
hf auth login                                         # or set HF_TOKEN
hf containers build -t cr.hf.co/my-org/my-app:v2 .    # build from your Dockerfile and push
hf containers tag my-app cr.hf.co/my-org/my-app:v2    # or name a local image
hf containers push cr.hf.co/my-org/my-app:v2          # and push it
hf containers pull cr.hf.co/my-org/my-app:v2
hf containers run --rm cr.hf.co/my-org/my-app:v2      # pull if needed, then docker run

It uses your Hugging Face User Access Token (read to pull, write to push) and needs Docker with the containerd image store, on Linux or macOS. Any client can pull the images it pushes, and it pulls images pushed by any client.

Because hf containers stores layers uncompressed, the images it pushes get different digests than with docker push and use more storage. To keep the docker push digests, for signatures or deployments pinned by digest, use hf containers push --preserve-digests. It is slower: a changed layer is then uploaded in full, and pulls decompress it, as with docker push.

Copying Images from Other Registries

hf containers copy brings an image from another registry, such as Docker Hub, ghcr.io, quay.io or registry.k8s.io, to a container repository, without pulling it into Docker first:

hf containers copy vllm/vllm-openai:v0.11.0 cr.hf.co/my-org/vllm-openai    # from Docker Hub, keeps the tag
hf containers copy registry.k8s.io/pause:3.10 cr.hf.co/my-org/pause:3.10

Name the source as for docker pull: without a registry host, it is on Docker Hub. For a private source, log in to its registry first with docker login. The destination repository must exist; a destination without a tag takes the source’s tag. Every platform of a multi-arch image is copied.

To optimize for Xet deduplication, layers are stored uncompressed, like with hf containers push: the copy gets different digests than its source and uses more storage. To keep the source’s digests, use --preserve-digests.

Using Docker and Other OCI Clients

The registry works with any OCI client. Log in with your Hugging Face username and a User Access Token as the password: read to pull, write to push. Public images can be pulled without logging in.

echo $HF_TOKEN | docker login cr.hf.co -u <username> --password-stdin
docker tag my-app cr.hf.co/my-org/my-app:v1
docker push cr.hf.co/my-org/my-app:v1
docker pull cr.hf.co/my-org/my-app:v1

Other OCI clients work the same way. Helm appends the chart name to the URL: helm push mychart-0.1.0.tgz oci://cr.hf.co/my-org pushes to my-org/mychart, which must exist beforehand.

Pulling from Kubernetes

Store a read token in a pull secret, then reference it from your pods:

kubectl create secret docker-registry hf-registry \
  --docker-server=cr.hf.co \
  --docker-username=<username> \
  --docker-password=$HF_TOKEN
apiVersion: v1
kind: Pod
metadata:
  name: my-app
spec:
  containers:
    - name: my-app
      image: cr.hf.co/my-org/my-app:v1
  imagePullSecrets:
    - name: hf-registry

Public images need no pull secret, but with one, pulls count against your account’s rate limits instead of your cluster’s IP address. Images pushed with hf containers pull the same way.

Pushing from GitHub Actions

To push without storing a token, add a trusted publisher for your GitHub repository in the container repository’s Settings → Trusted Publishers. The job then exchanges its OIDC ID token for a token that can only push to and pull from that repository, and expires after 60 minutes. Set HF_OIDC_RESOURCE to the repository, and push with hf containers:

permissions:
  id-token: write  # lets the job request an OIDC token
  contents: read

steps:
  - uses: actions/checkout@v4
  - uses: docker/setup-docker-action@v5
    with:
      daemon-config: '{"features": {"containerd-snapshotter": true}}'  # hf containers needs the containerd image store
  - name: Install hf containers
    run: |
      curl -LsSf https://hf.co/cli/install.sh | bash
      echo "$HOME/.local/bin" >> "$GITHUB_PATH"
      "$HOME/.local/bin/hf" extensions install hf-containers
  - name: Build and push
    env:
      HF_OIDC_RESOURCE: containers/my-org/my-app
    run: hf containers build -t cr.hf.co/my-org/my-app:${{ github.sha }} .

To push with Docker instead, replace the last step with a login using the exchanged token, then build and push as usual:

  - name: Log in to cr.hf.co
    env:
      HF_OIDC_RESOURCE: containers/my-org/my-app
    run: hf auth token | docker login cr.hf.co -u oauth2 --password-stdin
  - uses: docker/build-push-action@v7
    with:
      push: true
      tags: cr.hf.co/my-org/my-app:${{ github.sha }}

Without a trusted publisher, store a write token as a repository secret and set HF_TOKEN: ${{ secrets.HF_TOKEN }} instead of HF_OIDC_RESOURCE. With a read-only publisher, the token can only pull.

Deleting Images

On the Hub, remove a tag using Delete this tag in its menu, on the image or tag’s page. With hf containers, remove a tag, or an image by digest (rm for short):

hf containers remove cr.hf.co/my-org/my-app:v1                # the tag; prints the image's digest
hf containers remove cr.hf.co/my-org/my-app:v1 --image        # the tag, and its image unless something else references it
hf containers remove cr.hf.co/my-org/my-app@sha256:<digest>   # the image

Removing its tags is enough: garbage collection deletes the image a few hours later. Removing it by digest deletes it right away. If something still references the image, such as another tag, that is refused and lists what to remove first. Deleting a multi-arch image leaves its platform images to garbage collection.

To delete the repository itself, with all its images, use hf containers delete my-org/my-app: it asks first, unless you pass --yes.

Other clients that delete tags work too, such as crane:

crane delete cr.hf.co/my-org/my-app:v1

Garbage Collection

The registry deletes images that no tag points to anymore, directly or through a multi-arch image, such as the previous latest after a new push. It also deletes the layers that no remaining image uses. To keep pulling an image by digest, keep a tag on it.

Limits

  • Image names are cr.hf.co/<namespace>/<name>, in lowercase.
  • Layers up to 100 GB, manifests up to 4 MiB.
  • Tag lists can take a few seconds to show a new tag.
  • Pulls count toward your Hub rate limits as resolver requests: log in so they count against your account rather than your IP address.

Pricing

Images are billed as storage of the organization that owns them: private storage for private repositories, public storage for public ones, shared with its models, datasets and buckets. Each repository counts a layer once, however many tags and images use it, at the size it was pushed: compressed with docker push and other OCI clients, uncompressed with hf containers.

To see the trade-off between compression and Xet deduplication, say you rebuild a 2 GB layer after updating 100 MB of dependencies.

  • With docker push, the compressed layer takes up less storage, but Docker uploads the whole rebuilt layer because its digest has changed.
  • With hf containers push, Xet can recognize unchanged chunks in the uncompressed layer. If it can reuse the other 1.9 GB, you upload roughly 100 MB. The rebuilt layer counts as 2 GB toward your organization’s storage.

Pulls count toward the egress allowance included in your plan, shown in Download Analytics.

Private storage is included in every plan: 100 GB for a free organization, and 1 TB per seat for Team and Enterprise organizations. Beyond it, Team and Enterprise organizations pay $18 per TB per month, with discounts at volume; a free organization needs to upgrade. For example:

  • 20 tagged versions of an image pushed as 5 GB, all sharing the same 4 GB base layers, take 4 + 20 × 1 = 24 GB: they fit in a free organization’s private storage.
  • A Team organization with 10 members includes 10 TB of private storage. 12 releases of a vLLM image, about 9 GB each compressed and 21 GB uncompressed, use 110 GB of it pushed with docker push, 250 GB with hf containers.

For usage above the free tier, see hf.co/storage. For general billing information, see the Billing documentation.

Update on GitHub