docker
A Dagger Module for integrating with the Docker Engine
Installation
dagger install github.com/KimNorgaard/daggerverse/docker@287b9e1f5a11fe59bee62182ab57c104c8c4aa38
Entrypoint
Return Type
Docker
Example
dagger -m github.com/KimNorgaard/daggerverse/docker@287b9e1f5a11fe59bee62182ab57c104c8c4aa38 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 | "26.1" | 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/KimNorgaard/daggerverse/docker@287b9e1f5a11fe59bee62182ab57c104c8c4aa38 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 | "26.1" | Version of the Docker CLI to run. |
engine | Service | - | Specify the Docker Engine to connect to. By default, run an ephemeral engine. |
socket | Socket | - | Unix socket to connect to the external Docker Engine.Please carefully use this option it can expose your host to the container. |
Example
echo 'Custom types are not supported in shell examples'
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
container() 🔗
Package the Docker CLI into a container, wired to an engine
Return Type
Container !
Example
echo 'Custom types are not supported in shell examples'
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()
}
run() 🔗
Run a container with the docker CLI
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
args | [String ! ] ! | - | Arguments to pass to the docker CLI command to run |
Example
echo 'Custom types are not supported in shell examples'
func (m *myModule) example(ctx context.Context, args []string) string {
return dag.
Docker().
Cli().
Run(ctx, args)
}
@function
async def example(args: List[str]) -> str:
return await (
dag.docker()
.cli()
.run(args)
)
@func()
async example(args: string[]): Promise<string> {
return dag
.docker()
.cli()
.run(args)
}