Community编程与开发github.com

local-registry

启动和管理本地OCI容器镜像仓库,用于Bottlerocket套件开发

local-registry 是什么?

该技能支持开发者启动和管理本地OCI容器镜像仓库,特别适用于Bottlerocket套件(kit)的本地开发与测试。通过该技能,用户可以在不依赖外部镜像仓库的情况下,完成套件的构建、发布和消费,适合离线环境或隔离网络。技能基于`brdev` CLI工具,自动管理Docker容器的生命周期,包括启动、停止、清理和日志查看。它支持自定义镜像、端口自动派生、持久化存储等功能。典型使用场景包括:在本地开发套件变更后需要被变体(variant)消费时、测试套件变更后再发布到生产仓库时,或完全离线开发。该技能还与`build-kit-locally`和`build-variant-from-local-kits`等技能配合使用,并通过`brdev twoliter`系列命令与Twoliter构建系统集成。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cbgbt/bottlerocket-forest/tree/main/skills/local-registry

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

技能:本地 OCI 镜像仓库

目的

启动和管理用于开发的本地 OCI 镜像仓库。这允许在不需要外部镜像仓库访问权限的情况下本地构建和发布套件(kits)。

何时使用

  • 开发对需要被变体(variants)消费的套件的变更
  • 在发布到生产镜像仓库之前测试套件变更
  • 在离线或隔离环境中工作

前提条件

  • 已安装并运行 Docker
  • 在 grove 目录中工作

步骤

启动镜像仓库

brdev registry start

此操作将:

  • 在 localhost:5000 上启动一个本地 Docker 镜像仓库
  • 配置持久化(镜像仓库数据在重启后保留)
  • 等待镜像仓库健康状态后返回
  • 输出供构建使用的镜像仓库 URL

验证镜像仓库正在运行

brdev registry status

如果正在运行,返回退出码 0;否则返回非零退出码。

获取镜像仓库 URL

brdev registry url

输出当前 grove 对应的 localhost:{port}。在脚本中使用此命令,避免硬编码端口。

查看镜像仓库日志

brdev registry logs

实时跟踪日志:

brdev registry logs --follow

停止镜像仓库

brdev registry stop

注意:此操作会保留镜像仓库数据卷。

清理镜像仓库数据

brdev registry clean

此操作会移除容器和数据卷。

配置

brdev 使用环境变量进行配置。在森林(forest)根目录创建 .env 文件或设置环境变量:

# 自定义镜像(默认:registry:2)
BRDEV_REGISTRY_IMAGE=registry:2.8

注意:容器和卷的名称会自动从 grove 名称派生,格式为 brdev-registry-{grove} 和 brdev-registry-data-{grove}。端口通过 grove 名称的哈希自动派生(范围 5001-5999)。

验证

启动镜像仓库后:

brdev registry list

应返回:{"repositories":[]}

常见问题

Docker 未安装:

Error: Docker is not installed or not in PATH. Install Docker and ensure it's in your PATH

解决方案:安装 Docker 并确保其在 PATH 中。

Docker 守护进程未运行:

Error: Docker daemon is not running. Start Docker with: sudo systemctl start docker

解决方案:启动 Docker 守护进程。

端口已被占用:

Error: Failed to start container. The port may already be in use

解决方案:

  • 检查现有镜像仓库:docker ps | grep registry
  • 停止冲突容器:docker stop <container-id>
  • 或通过 FORESTER_REGISTRY_PORT 使用自定义端口

权限拒绝:

  • 确保用户位于 docker 组中:groups | grep docker
  • 将用户添加到 docker 组:sudo usermod -aG docker $USER
  • 添加到组后可能需要重启 shell

相关技能

  • build-kit-locally - 使用本地镜像仓库发布构建好的套件
  • build-variant-from-local-kits - 配置变体构建以使用本地镜像仓库

另请参阅

本地镜像仓库使用的配置命令:

发布套件:

  • brdev twoliter use-local-publish - 创建用于发布到本地镜像仓库的 Infra.toml
  • brdev twoliter use-upstream-publish - 移除 Infra.toml

获取套件:

  • brdev twoliter use-local-deps - 创建用于从本地镜像仓库获取依赖的 Twoliter.override
  • brdev twoliter use-upstream-deps - 移除 Twoliter.override

两者(便捷):

  • brdev twoliter use-local - 同时创建上述两个文件
  • brdev twoliter use-upstream - 同时移除上述两个文件

获取时,还需要在 Twoliter.toml 中为希望从本地镜像仓库获取的特定套件设置 vendor = "local"。

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

ad-hoc-implementation-plan

Transform a rough plan into implement-commit ready artifacts. Allows rigorous review while implementing.

build-kit-locally

Build a kit and publish it to a locally hosted registry for development testing

build-variant-from-local-kits

Build a variant using locally published kits for development validation

deep-research

Create educational documents that build understanding progressively with citations

edit-spec-file

Edit Bottlerocket RPM spec files following project style conventions

fact-find

Quick lookup of specific facts about Bottlerocket with citations

idea-honing

Clarify feature ideas through iterative Q&A, recording insights to guide concept development

implement-commit

Implement commits from an implementation plan using a TDD pipeline

prepare-core-kit-release

Prepare bottlerocket-core-kit for release by bumping version and updating changelog

propose-feature-concept

Create a new feature concept document to pitch the idea and explain the problem/solution

propose-feature-design

Create or update feature technical design document with architecture and implementation guidance

propose-feature-requirements

Create or update feature requirements specification using EARS notation with examples and appendices

propose-feature-test-plan

Create a test plan mapping EARS requirements and Critical Constraints to specific tests

propose-implementation-plan

Create an implementation plan with atomic commits that build toward a complete feature

review-code

Deep code review generating PR comments via principled question-driven analysis

review-scope

Verify code changes match intended scope and requirements without exceeding boundaries

review-style

Verify code follows project style guides without providing improvement suggestions

test-local-twoliter

Build and test local changes to twoliter before releasing

update-twoliter

Update all Bottlerocket repositories to a new Twoliter version

相关技能