Community程式設計與開發github.com

local-registry

啟動並管理用於 Bottlerocket 套件開發的本機 OCI 註冊表。

local-registry 是什麼?

這個技能提供了一組命令,用於在開發環境中啟動、管理和清理本機 OCI 註冊表,特別針對 Bottlerocket 套件(kit)的開發。它讓開發者可以在沒有外部註冊表存取權限的情況下,本地端建置與發佈套件。技能支援 Docker 容器環境,並自動處理註冊表的持久化儲存、健康狀態檢查以及連接埠配置。主要平台為 `brdev` CLI 工具,適用於離線開發、測試套件變更,以及建置需要被其他變體使用的套件。也與 `build-kit-locally` 和 `build-variant-from-local-kits` 等其他技能互相配合,形成完整的本地開發流程。

相容平台~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 註冊表。這允許在本機建置與發佈套件,無需外部註冊表存取權限。

使用時機

  • 正在開發需要被變體使用的套件
  • 將套件變更發佈到正式註冊表之前進行測試
  • 在離線或隔離環境中工作

先決條件

  • 已安裝並執行 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

相關技能