Skills2026年4月16日·1 分钟阅读

Distribution — The OCI Container Registry Toolkit

The reference implementation of the OCI Distribution Specification for storing and distributing container images and artifacts. Distribution powers Docker Hub, GitHub Container Registry, and most private registries behind the scenes.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Distribution Registry
直接安装命令
npx -y tokrepo@latest install d71cfb41-398f-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
Distribution is the reference OCI container registry implementation that powers Docker Hub, GitHub Container Registry, and most private registries.
§01

What it is

Distribution is the reference implementation of the OCI Distribution Specification. It provides a container image registry that stores and serves Docker and OCI container images. This is the same codebase that powers Docker Hub, GitHub Container Registry (GHCR), and most private registries. You deploy it as a single binary or Docker container to host your own image registry.

Distribution targets platform engineers, DevOps teams, and organizations that need a private container registry for security, compliance, or performance reasons.

§02

How it saves time or tokens

Pulling images from public registries like Docker Hub introduces rate limits, latency, and dependency on external infrastructure. Running your own registry with Distribution eliminates rate limits, keeps images on your network, and gives you full control over access. For CI/CD pipelines that build and deploy frequently, a local registry cuts image pull times from seconds to milliseconds.

§03

How to use

  1. Run a local registry:
docker run -d -p 5000:5000 --name registry registry:2
  1. Tag and push an image:
docker tag my-image localhost:5000/my-image
docker push localhost:5000/my-image
  1. Pull from your registry:
docker pull localhost:5000/my-image
§04

Example

# docker-compose.yml - Production registry with persistent storage
version: '3'
services:
  registry:
    image: registry:2
    ports:
      - '5000:5000'
    volumes:
      - registry-data:/var/lib/registry
    environment:
      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '["*"]'

volumes:
  registry-data:

This sets up a persistent registry with image deletion enabled.

§05

Related on TokRepo

§06

Common pitfalls

  • The default registry has no authentication. Add TLS and basic auth or token auth before exposing it outside localhost.
  • Storage grows indefinitely without garbage collection. Run registry garbage-collect periodically to reclaim space from deleted images.
  • Docker requires HTTPS for non-localhost registries by default. Either add TLS certificates or configure Docker to allow insecure registries (not recommended for production).

常见问题

Is Distribution the same as Docker Registry?+

Yes. Docker Registry v2 is built on the Distribution project. The registry:2 Docker image is the official Distribution release. The project moved from Docker to the CNCF under the name Distribution.

Does Distribution support OCI artifacts?+

Yes. Distribution implements the OCI Distribution Specification and supports storing any OCI artifact, including Helm charts, Wasm modules, and supply chain artifacts like SBOMs.

How do I add authentication?+

Distribution supports htpasswd-based basic auth, token-based auth, and external auth services. Configure the auth section in the registry config.yml file. For production, use token-based auth with TLS.

Can Distribution replicate images between registries?+

Distribution itself does not include built-in replication. Use tools like Skopeo, crane, or Harbor (which uses Distribution under the hood) for cross-registry image replication.

How much storage does a registry need?+

Storage depends on image count and size. Container images range from tens of MB to several GB. Plan for at least 100GB for a moderate team. Enable garbage collection and set retention policies to manage growth.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产