summaryrefslogtreecommitdiffstats
path: root/recipes-containers/container-registry/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/container-registry/README.md')
-rw-r--r--recipes-containers/container-registry/README.md140
1 files changed, 140 insertions, 0 deletions
diff --git a/recipes-containers/container-registry/README.md b/recipes-containers/container-registry/README.md
new file mode 100644
index 00000000..11db39bb
--- /dev/null
+++ b/recipes-containers/container-registry/README.md
@@ -0,0 +1,140 @@
1# Container Registry Infrastructure
2
3Local container registry for Yocto/OE builds - analogous to package-index for containers.
4
5## Quick Start
6
7```bash
8# 1. Configure in local.conf
9CONTAINER_REGISTRY_URL = "localhost:5000"
10CONTAINER_REGISTRY_NAMESPACE = "yocto"
11CONTAINER_REGISTRY_INSECURE = "1"
12
13# 2. Generate the helper script
14bitbake container-registry-index -c generate_registry_script
15
16# 3. Start registry, push images
17$TOPDIR/container-registry/container-registry.sh start
18$TOPDIR/container-registry/container-registry.sh push
19
20# 4. Import 3rd party images
21$TOPDIR/container-registry/container-registry.sh import docker.io/library/alpine:latest
22
23# 5. Use with vdkr (10.0.2.2 is QEMU slirp gateway to localhost)
24vdkr vconfig registry 10.0.2.2:5000/yocto
25vdkr pull container-base
26```
27
28## Helper Script Commands
29
30Script location: `${TOPDIR}/container-registry/container-registry.sh` (outside tmp/, persists)
31
32| Command | Description |
33|---------|-------------|
34| `start` | Start the container registry server |
35| `stop` | Stop the container registry server |
36| `status` | Check if registry is running |
37| `push` | Push all OCI images from deploy/ to registry |
38| `import <image> [name]` | Import 3rd party image to registry |
39| `list` | List all images with their tags |
40| `tags <image>` | List tags for a specific image |
41| `catalog` | Raw API catalog output |
42
43## Configuration (local.conf)
44
45```bitbake
46# Registry endpoint (host-side)
47CONTAINER_REGISTRY_URL = "localhost:5000"
48
49# Image namespace
50CONTAINER_REGISTRY_NAMESPACE = "yocto"
51
52# Mark as insecure (HTTP)
53CONTAINER_REGISTRY_INSECURE = "1"
54
55# For Docker targets
56DOCKER_REGISTRY_INSECURE = "localhost:5000"
57
58# Persistent storage (default: ${TOPDIR}/container-registry)
59CONTAINER_REGISTRY_STORAGE = "/data/container-registry"
60```
61
62## vdkr Registry Usage
63
64### Pull Behavior with Registry Fallback
65
66When a registry is configured, vdkr uses **registry-first, Docker Hub fallback** for pulls:
67
681. Try configured registry first (e.g., `10.0.2.2:5000/yocto/alpine`)
692. If not found, fall back to Docker Hub (`docker.io/library/alpine`)
70
71This allows you to override images with local builds while still pulling public images normally.
72
73```bash
74# One-off
75vdkr --registry 10.0.2.2:5000/yocto pull alpine
76
77# Persistent config
78vdkr vconfig registry 10.0.2.2:5000/yocto
79vdkr pull alpine # Tries registry first, falls back to Docker Hub
80vdkr pull container-base # Pulls from registry (your Yocto-built image)
81vdkr run alpine echo hello
82
83# Clear config
84vdkr vconfig registry --reset
85
86# Image management (all commands use registry prefix for stored images)
87vdkr image ls
88vdkr image inspect alpine # Works for both registry and Docker Hub images
89vdkr image rm <image>
90vdkr image rm e7b39c54cdec # Image IDs work without transformation
91```
92
93### Registry Transform
94
95When a registry is configured:
96- `pull`, `run` - Use fallback (registry first, then Docker Hub)
97- `inspect`, `history`, `rmi`, `tag`, `images` - No transform (use actual local image names)
98- Image IDs (hex strings like `e7b39c54cdec`) - Never transformed
99
100## Baking Registry Config into Target Images
101
102Use `IMAGE_FEATURES` to auto-select the right package based on `CONTAINER_PROFILE`:
103
104```bitbake
105# In local.conf
106CONTAINER_REGISTRY_URL = "localhost:5000"
107CONTAINER_REGISTRY_INSECURE = "1"
108DOCKER_REGISTRY_INSECURE = "localhost:5000"
109
110# Enable the feature
111IMAGE_FEATURES:append = " container-registry"
112```
113
114This installs:
115- **Docker profile** → `docker-registry-config` → `/etc/docker/daemon.json`
116- **Podman profile** → `container-oci-registry-config` → `/etc/containers/registries.conf.d/`
117
118## Files
119
120| File | Description |
121|------|-------------|
122| `container-registry-index.bb` | Generates helper script with baked-in paths |
123| `container-registry-populate.bb` | Alternative bitbake-driven push |
124| `container-oci-registry-config.bb` | OCI tools config (Podman/Skopeo/Buildah/CRI-O) |
125| `docker-registry-config.bb` | Docker daemon config |
126| `files/container-registry-dev.yml` | Development registry config |
127
128## Storage
129
130Registry data and script are stored at `${TOPDIR}/container-registry/` by default:
131- Outside tmp/, persists across builds and cleanall
132- Imported and pushed images are copied here
133- Script regenerates with same paths after tmp/ cleanup
134
135## Localhost to 10.0.2.2 Translation
136
137For vdkr baked configs, `localhost` URLs are auto-translated to `10.0.2.2` (QEMU slirp gateway):
138- Set `CONTAINER_REGISTRY_URL = "localhost:5000"` in local.conf
139- Host-side operations use localhost directly
140- vdkr inside QEMU accesses via 10.0.2.2 automatically