crane
This module provides functionality for copying container images betweenregistries using Google’s `crane` CLI, wrapped in a Dagger pipeline.
It supports authentication, platform targeting, and insecure registry access.
The module is ideal for scenarios where images need to be promoted between
environments (e.g., dev → staging → production) or mirrored across
different registry backends.
Typical usage includes:
- Copying an image from one registry to another (e.g., Harbor to GHCR)
- Providing credentials for source and/or target registries
- Optionally specifying platform (e.g., "linux/amd64")
- Allowing insecure registries in air-gapped or self-hosted setups
This module is designed to be used as part of a CI/CD pipeline via the
Dagger CLI or SDKs.
Installation
dagger install github.com/stuttgart-things/dagger/crane@v0.23.0
Entrypoint
Return Type
Crane
Example
dagger -m github.com/stuttgart-things/dagger/crane@41f188e601ad0a6cef3e70bf61bc318fe82eec71 call \
func (m *MyModule) Example() *dagger.Crane {
return dag.
Crane()
}
@function
def example() -> dagger.Crane:
return (
dag.crane()
)
@func()
example(): Crane {
return dag
.crane()
}
Types
Crane 🔗
Crane installs Crane CLI on a Wolfi base image at runtime @module
baseImage() 🔗
Base Wolfi image to use
Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/crane@41f188e601ad0a6cef3e70bf61bc318fe82eec71 call \
base-image
func (m *MyModule) Example(ctx context.Context) string {
return dag.
Crane().
BaseImage(ctx)
}
@function
async def example() -> str:
return await (
dag.crane()
.base_image()
)
@func()
async example(): Promise<string> {
return dag
.crane()
.baseImage()
}
version() 🔗
Crane version to install (e.g., “latest” or specific version)
Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/crane@41f188e601ad0a6cef3e70bf61bc318fe82eec71 call \
version
func (m *MyModule) Example(ctx context.Context) string {
return dag.
Crane().
Version(ctx)
}
@function
async def example() -> str:
return await (
dag.crane()
.version()
)
@func()
async example(): Promise<string> {
return dag
.crane()
.version()
}
copy() 🔗
Copy copies an image between registries with authentication +call
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | String ! | - | No description provided |
target | String ! | - | No description provided |
sourceRegistry | String | - | No description provided |
sourceUsername | String | - | No description provided |
sourcePassword | Secret | - | No description provided |
targetRegistry | String | - | No description provided |
targetUsername | String | - | No description provided |
targetPassword | Secret | - | No description provided |
insecure | Boolean | false | No description provided |
platform | String | "linux/amd64" | No description provided |
dockerConfigSecret | Secret | - | NEW: Docker config.json secret |
Example
dagger -m github.com/stuttgart-things/dagger/crane@41f188e601ad0a6cef3e70bf61bc318fe82eec71 call \
copy --source string --target string
func (m *MyModule) Example(ctx context.Context, source string, target string) string {
return dag.
Crane().
Copy(ctx, source, target)
}
@function
async def example(source: str, target: str) -> str:
return await (
dag.crane()
.copy(source, target)
)
@func()
async example(source: string, target: string): Promise<string> {
return dag
.crane()
.copy(source, target)
}