Hub documentation

Container Repos Access Control

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Container Repos Access Control

Who can pull and push an image follows the repository’s visibility and each member’s role in the organization: anyone can pull from a public repository, only members from a private one, and pushing needs the write role. Tokens follow the same rule: a User Access Token with read pulls, one with write pushes. CI jobs can also push without a stored token through a trusted publisher configured on the repository.

Access Control with Resource Groups

In an organization on a Team or Enterprise plan, a container repository can belong to a Resource Group. The members’ role in the group then replaces their organization role for that repository: read to pull, write to push. A private repository in a Resource Group can only be pulled from by the group’s members and the organization admins.

Choose the group when creating the repository, from the repository’s settings, or from the Resources tab of the group. With the API, pass resourceGroupId when creating the repository, or move an existing one (the group’s ID ends its page URL, and GET /api/organizations/my-org/resource-groups lists them):

curl -X POST https://huggingface.co/api/containers/my-org/my-app/resource-group \
  -H "Authorization: Bearer $HF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"resourceGroupId": "<resource-group-id>"}'

With the hf CLI, assign a repository to a group, or take it out of its group:

hf resource-groups assign <resource-group-id> my-org/my-app --type container
hf resource-groups unassign my-org/my-app --type container

hf resource-groups ls --org my-org lists the groups with their IDs.

Update on GitHub