Dagger
Search

docker

A Dagger Module for integrating with the Docker Engine

Installation

dagger install github.com/KimNorgaard/daggerverse/docker@a9b1639ce6fd0bb81faed1f0ce7d2d69ab05c893

Entrypoint

Return Type
Docker
Example
dagger -m github.com/KimNorgaard/daggerverse/docker@a9b1639ce6fd0bb81faed1f0ce7d2d69ab05c893 call \
func (m *MyModule) Example() *dagger.Docker  {
	return dag.
			Docker()
}
@function
def example() -> dagger.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
NameTypeDefault ValueDescription
versionString "26.1"Docker Engine version
persistBoolean truePersist the state of the engine in a cache volume
namespaceString -Namespace for persisting the engine state. Use in combination with `persist`
invalidateCacheBoolean falseInvalidateCache is a flag for indicating whether the dagger cache should be invalidated after completion
Example
dagger -m github.com/KimNorgaard/daggerverse/docker@a9b1639ce6fd0bb81faed1f0ce7d2d69ab05c893 call \
 engine
func (m *MyModule) Example() *dagger.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
NameTypeDefault ValueDescription
versionString "26.1"Version of the Docker CLI to run.
engineService -Specify the Docker Engine to connect to. By default, run an ephemeral engine.
socketSocket -Unix socket to connect to the external Docker Engine.Please carefully use this option it can expose your host to the container.
invalidateCacheBoolean falseInvalidateCache is a flag for indicating whether the dagger cache should be invalidated after completion
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example() *dagger.DockerCli  {
	return dag.
			Docker().
			Cli()
}
@function
def example() -> dagger.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() *dagger.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
NameTypeDefault ValueDescription
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)
}