docker
A Dagger Module for integrating with the Docker Engine
Installation
dagger install github.com/shykes/daggerverse/docker@v0.4.3
Entrypoint
Return Type
Docker
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
func (m *myModule) example() *Docker {
return dag.
Docker()
}
@function
def example() -> dag.Docker:
return (
dag.docker()
)
@func()
example(): Docker {
return dag
.docker()
}
Types
Docker 🔗
A Dagger module to integrate with Docker
engine() 🔗
Spawn an ephemeral Docker Engine in a container
Return Type
Service !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | "24.0" | Docker Engine version |
persist | Boolean | true | Persist the state of the engine in a cache volume |
namespace | String | - | Namespace for persisting the engine state. Use in combination with `persist` |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
engine
func (m *myModule) example() *Service {
return dag.
Docker().
Engine()
}
@function
def example() -> dagger.Service:
return (
dag.docker()
.engine()
)
@func()
example(): Service {
return dag
.docker()
.engine()
}
cli() 🔗
A Docker CLI ready to query this engine.
Entrypoint is set to docker
Return Type
Cli !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | "24.0" | Version of the Docker CLI to run. |
engine | Service | - | Specify the Docker Engine to connect to. By default, run an ephemeral engine. |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli
func (m *myModule) example() *DockerCli {
return dag.
Docker().
Cli()
}
@function
def example() -> dag.DockerCli:
return (
dag.docker()
.cli()
)
@func()
example(): DockerCli {
return dag
.docker()
.cli()
}
Cli 🔗
A Docker client
engine() 🔗
Return Type
Service !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
engine
func (m *myModule) example() *Service {
return dag.
Docker().
Cli().
Engine()
}
@function
def example() -> dagger.Service:
return (
dag.docker()
.cli()
.engine()
)
@func()
example(): Service {
return dag
.docker()
.cli()
.engine()
}
container() 🔗
Package the Docker CLI into a container, wired to an engine
Return Type
Container !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
container
func (m *myModule) example() *Container {
return dag.
Docker().
Cli().
Container()
}
@function
def example() -> dagger.Container:
return (
dag.docker()
.cli()
.container()
)
@func()
example(): Container {
return dag
.docker()
.cli()
.container()
}
pull() 🔗
Execute ‘docker pull’
Return Type
Image !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String ! | - | The docker repository to pull from. Example: registry.dagger.io/engine |
tag | String | "latest" | The docker image tag to pull |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
pull --repository string
func (m *myModule) example(repository string) *DockerImage {
return dag.
Docker().
Cli().
Pull(repository)
}
@function
def example(repository: str) -> dag.DockerImage:
return (
dag.docker()
.cli()
.pull(repository)
)
@func()
example(repository: string): DockerImage {
return dag
.docker()
.cli()
.pull(repository)
}
push() 🔗
Execute ‘docker push’
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String ! | - | The docker repository to push to. |
tag | String | "latest" | The tag to push to. |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
push --repository string
func (m *myModule) example(ctx context.Context, repository string) string {
return dag.
Docker().
Cli().
Push(ctx, repository)
}
@function
async def example(repository: str) -> str:
return await (
dag.docker()
.cli()
.push(repository)
)
@func()
async example(repository: string): Promise<string> {
return dag
.docker()
.cli()
.push(repository)
}
withPull() 🔗
Execute ‘docker pull’ and return the CLI state, for chaining.
Return Type
Cli !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String ! | - | The docker repository to pull from |
tag | String | "latest" | The tag to pull from |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
with-pull --repository string
func (m *myModule) example(repository string) *DockerCli {
return dag.
Docker().
Cli().
WithPull(repository)
}
@function
def example(repository: str) -> dag.DockerCli:
return (
dag.docker()
.cli()
.with_pull(repository)
)
@func()
example(repository: string): DockerCli {
return dag
.docker()
.cli()
.withPull(repository)
}
withPush() 🔗
Execute ‘docker push’ and return the CLI state, for chaining.
Return Type
Cli !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String ! | - | The docker repository to push to. |
tag | String | "latest" | The tag to push to. |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
with-push --repository string
func (m *myModule) example(repository string) *DockerCli {
return dag.
Docker().
Cli().
WithPush(repository)
}
@function
def example(repository: str) -> dag.DockerCli:
return (
dag.docker()
.cli()
.with_push(repository)
)
@func()
example(repository: string): DockerCli {
return dag
.docker()
.cli()
.withPush(repository)
}
import() 🔗
Import a container into the Docker Engine
Return Type
Image !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
container | Container ! | - | The container to load |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
import --container IMAGE:TAG
func (m *myModule) example(container *Container) *DockerImage {
return dag.
Docker().
Cli().
Import(container)
}
@function
def example(container: dagger.Container) -> dag.DockerImage:
return (
dag.docker()
.cli()
.import_(container)
)
@func()
example(container: Container): DockerImage {
return dag
.docker()
.cli()
.import(container)
}
image() 🔗
Look up an image in the local Docker Engine cache If exactly one image matches the filters, return it. Otherwise, return an error.
Return Type
Image !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String | - | Filter by image repository |
tag | String | "latest" | Filter by image tag |
localId | String | - | Filter by image local ID (short IDs are allowed) |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image
func (m *myModule) example() *DockerImage {
return dag.
Docker().
Cli().
Image()
}
@function
def example() -> dag.DockerImage:
return (
dag.docker()
.cli()
.image()
)
@func()
example(): DockerImage {
return dag
.docker()
.cli()
.image()
}
run() 🔗
Run a container with the docker CLI
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | Name of the image to run. Example: registry.dagger.io/engine |
tag | String | "latest" | Tag of the image to run. |
args | [String ! ] | - | Additional arguments |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
run --name string
func (m *myModule) example(ctx context.Context, name string) string {
return dag.
Docker().
Cli().
Run(ctx, name)
}
@function
async def example(name: str) -> str:
return await (
dag.docker()
.cli()
.run(name)
)
@func()
async example(name: string): Promise<string> {
return dag
.docker()
.cli()
.run(name)
}
images() 🔗
List images on the local Docker Engine cache
Return Type
[Image ! ] !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String | - | Filter by repository |
tag | String | - | Filter by tag |
localId | String | - | Filter by image ID |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
images
func (m *myModule) example() []*DockerImage {
return dag.
Docker().
Cli().
Images()
}
@function
def example() -> List[dag.DockerImage]:
return (
dag.docker()
.cli()
.images()
)
@func()
example(): DockerImage[] {
return dag
.docker()
.cli()
.images()
}
Image 🔗
An image store in the local Docker Engine cache
localId() 🔗
The local identifer of the docker image. Can’t call it ID…
Return Type
String !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
local-id
func (m *myModule) example(ctx context.Context) string {
return dag.
Docker().
Cli().
Image().
LocalId(ctx)
}
@function
async def example() -> str:
return await (
dag.docker()
.cli()
.image()
.local_id()
)
@func()
async example(): Promise<string> {
return dag
.docker()
.cli()
.image()
.localId()
}
tag() 🔗
Return Type
String !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
tag
func (m *myModule) example(ctx context.Context) string {
return dag.
Docker().
Cli().
Image().
Tag(ctx)
}
@function
async def example() -> str:
return await (
dag.docker()
.cli()
.image()
.tag()
)
@func()
async example(): Promise<string> {
return dag
.docker()
.cli()
.image()
.tag()
}
repository() 🔗
Return Type
String !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
repository
func (m *myModule) example(ctx context.Context) string {
return dag.
Docker().
Cli().
Image().
Repository(ctx)
}
@function
async def example() -> str:
return await (
dag.docker()
.cli()
.image()
.repository()
)
@func()
async example(): Promise<string> {
return dag
.docker()
.cli()
.image()
.repository()
}
export() 🔗
Export this image from the docker engine into Dagger
Return Type
Container !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
export
func (m *myModule) example() *Container {
return dag.
Docker().
Cli().
Image().
Export()
}
@function
def example() -> dagger.Container:
return (
dag.docker()
.cli()
.image()
.export()
)
@func()
example(): Container {
return dag
.docker()
.cli()
.image()
.export()
}
duplicate() 🔗
Duplicate this image under a new name.
This is equivalent to calling docker tag
Return Type
Image !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repository | String ! | - | The repository name to apply |
tag | String ! | - | The new tag to apply |
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
duplicate --repository string --tag string
func (m *myModule) example(repository string, tag string) *DockerImage {
return dag.
Docker().
Cli().
Image().
Duplicate(repository, tag)
}
@function
def example(repository: str, tag: str) -> dag.DockerImage:
return (
dag.docker()
.cli()
.image()
.duplicate(repository, tag)
)
@func()
example(repository: string, tag: string): DockerImage {
return dag
.docker()
.cli()
.image()
.duplicate(repository, tag)
}
push() 🔗
Push this image to a registry
Return Type
String !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
push
func (m *myModule) example(ctx context.Context) string {
return dag.
Docker().
Cli().
Image().
Push(ctx)
}
@function
async def example() -> str:
return await (
dag.docker()
.cli()
.image()
.push()
)
@func()
async example(): Promise<string> {
return dag
.docker()
.cli()
.image()
.push()
}
ref() 🔗
Return the image’s ref (remote address)
Return Type
String !
Example
dagger -m github.com/shykes/daggerverse/docker@c9a80c9eac0675a53a7e052da3594207f4235988 call \
cli \
image \
ref
func (m *myModule) example(ctx context.Context) string {
return dag.
Docker().
Cli().
Image().
Ref(ctx)
}
@function
async def example() -> str:
return await (
dag.docker()
.cli()
.image()
.ref()
)
@func()
async example(): Promise<string> {
return dag
.docker()
.cli()
.image()
.ref()
}