dagger Container.from and Container.publish support registryService
Introduced 2026-06-11 · score 0.96
HOW TO USE IT
When using a Dagger Service as the image registry, pass it as `RegistryService` to `Container.From` or `Container.Publish`. This selects that service for the registry operation without starting unrelated services attached to the container.
_, err := dag.Container().WithNewFile("/hello.txt", "hello").Publish(ctx, "<registry-host>:5000/<image>:<tag>", dagger.ContainerPublishOpts{RegistryService: registry})container := dag.Container().From("<registry-host>:5000/<image>:<tag>", dagger.ContainerFromOpts{RegistryService: registry})WHY THIS HELPS
Use a Dagger Service as the registry when pulling a container image or publishing one to a local ephemeral registry.
BEFORE THIS CHANGE
Before the explicit option, the implementation used services attached to the container for registry operations, which could start unrelated attached services.
REQUIREMENTS AND LIMITATIONS
- Version: v0.21.6
- address (required): Image reference used for the pull or push; its registry hostname must match the Service binding alias.
- registryService: The Dagger Service used as the registry endpoint; only this service is started for the pull or push. It is an option on both `Container.from` and `Container.publish`.
- Prerequisite: Use Dagger v0.21.6 or later for the `registryService` options.
- Prerequisite: Provide a Dagger Service for the registry and use an image reference whose registry hostname matches the service binding alias.
FIRST-PARTY EVIDENCE
- https://github.com/dagger/dagger/releases/tag/v0.21.6
- https://github.com/dagger/dagger/pull/13305/files
- https://github.com/dagger/dagger/pull/13305
Check the installed version and the source before using it. Entry JSON