@@ -46,6 +46,11 @@ There are two host-side stores, plus a host shell fallback:
4646 and visible to other processes running as your user. See
4747 [ Environment variables] ( #environment-variables ) .
4848
49+ Registry credentials are a separate store with a different purpose. They
50+ authenticate the ` sbx ` CLI (and optionally the sandbox itself) to private
51+ OCI registries for template and kit pulls, and are not used by the
52+ credential-injection proxy. See [ Registry credentials] ( #registry-credentials ) .
53+
4954If both a stored secret and a host environment variable are set for the same
5055service, the stored secret takes precedence. For multi-provider agents
5156(OpenCode, Docker Agent), the proxy selects credentials based on the API
@@ -127,8 +132,8 @@ List all stored secrets:
127132
128133``` console
129134$ sbx secret ls
130- SCOPE SERVICE SECRET
131- (global) github gho_GCaw4o****...****43qy
135+ SCOPE TYPE NAME SECRET
136+ (global) service github gho_GCaw4o****...****43qy
132137```
133138
134139Remove a secret:
@@ -203,6 +208,81 @@ proxy replaces it with the real value. The agent never sees the real secret.
203208Prefer the [ service-based flow] ( #stored-secrets ) whenever it's an option —
204209the kit handles the wiring; you only provide the value.
205210
211+ ## Registry credentials
212+
213+ Registry credentials authenticate to private OCI registries when pulling
214+ [ templates] ( ../customize/templates.md ) or [ kits] ( ../customize/kits.md ) . Use
215+ ` sbx secret set --registry <host> ` to store them. They are independent from
216+ service secrets: the proxy doesn't touch them, and they're used directly by
217+ the ` sbx ` CLI when resolving image references.
218+
219+ For Docker Hub, ` sbx ` reuses your ` sbx login ` session — no registry secret
220+ needed. For other registries (GitHub Container Registry, ECR, ACR,
221+ self-hosted Nexus, and so on), store credentials with `sbx secret set
222+ --registry`.
223+
224+ ### Store registry credentials
225+
226+ Pipe a token from stdin and target the registry hostname:
227+
228+ ``` console
229+ $ gh auth token | sbx secret set --registry ghcr.io --password-stdin
230+ ```
231+
232+ For registries that require a username (for example, ACR with an admin
233+ account), add ` --username ` :
234+
235+ ``` console
236+ $ echo " $ACR_PASSWORD " | sbx secret set \
237+ --registry myregistry.azurecr.io \
238+ --username myuser \
239+ --password-stdin
240+ ```
241+
242+ Three scopes control where the credential is used:
243+
244+ - Host-only (no ` -g ` , no sandbox name): the ` sbx ` CLI uses it to pull
245+ templates and kits when creating a sandbox. The credential is not
246+ injected into the sandbox itself, so processes inside the sandbox can't
247+ use it.
248+ - Global (` -g ` ): same as host-only, plus written into ` ~/.docker/config.json `
249+ in every new sandbox. Use this when agents need to pull or push from
250+ inside the sandbox — for example, when an agent builds and publishes
251+ container images.
252+ - Sandbox-scoped (positional ` SANDBOX ` argument): credential applies only
253+ to that named sandbox. Useful when only one sandbox needs access to a
254+ private registry.
255+
256+ ``` console
257+ $ gh auth token | sbx secret set -g --registry ghcr.io --password-stdin
258+ $ gh auth token | sbx secret set my-sandbox --registry ghcr.io --password-stdin
259+ ```
260+
261+ ` sbx kit pull ` also uses these credentials, with the Docker credential
262+ store as a fallback. ` sbx kit push ` uses only the Docker credential store —
263+ push targets still require a prior ` docker login ` .
264+
265+ ### Remove registry credentials
266+
267+ Remove both the host-only and global entries for a registry:
268+
269+ ``` console
270+ $ sbx secret rm --registry ghcr.io -f
271+ ```
272+
273+ To remove only the global (sandbox-injected) entry and leave the
274+ host-only credential in place, pass ` -g ` :
275+
276+ ``` console
277+ $ sbx secret rm -g --registry ghcr.io -f
278+ ```
279+
280+ To remove a sandbox-scoped credential, pass the sandbox name:
281+
282+ ``` console
283+ $ sbx secret rm my-sandbox --registry ghcr.io -f
284+ ```
285+
206286## Environment variables
207287
208288As an alternative to stored secrets, export the relevant environment variable
0 commit comments