docker
A Dagger Module for integrating with the Docker Engine
Installation
dagger install github.com/shykes/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770Entrypoint
Return Type
Docker Example
dagger -m github.com/shykes/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 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
| 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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
enginefunc (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
| 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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
clifunc (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
engine() 🔗
Return Type
Service ! Example
dagger -m github.com/shykes/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
enginefunc (m *MyModule) Example() *dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
containerfunc (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()
}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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
pull --repository stringfunc (m *MyModule) Example(repository string) *dagger.DockerImage {
return dag.
Docker().
Cli().
Pull(repository)
}@function
def example(repository: str) -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
push --repository stringfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
with-pull --repository stringfunc (m *MyModule) Example(repository string) *dagger.DockerCli {
return dag.
Docker().
Cli().
WithPull(repository)
}@function
def example(repository: str) -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
with-push --repository stringfunc (m *MyModule) Example(repository string) *dagger.DockerCli {
return dag.
Docker().
Cli().
WithPush(repository)
}@function
def example(repository: str) -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
import --container IMAGE:TAGfunc (m *MyModule) Example(container *dagger.Container) *dagger.DockerImage {
return dag.
Docker().
Cli().
Import(container)
}@function
def example(container: dagger.Container) -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
imagefunc (m *MyModule) Example() *dagger.DockerImage {
return dag.
Docker().
Cli().
Image()
}@function
def example() -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
run --name stringfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
imagesfunc (m *MyModule) Example() []*dagger.DockerImage {
return dag.
Docker().
Cli().
Images()
}@function
def example() -> List[dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
local-idfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
tagfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
repositoryfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
exportfunc (m *MyModule) Example() *dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
duplicate --repository string --tag stringfunc (m *MyModule) Example(repository string, tag string) *dagger.DockerImage {
return dag.
Docker().
Cli().
Image().
Duplicate(repository, tag)
}@function
def example(repository: str, tag: str) -> dagger.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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
pushfunc (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/x/docker@c71f1e5edcda371e19f754f0eab1faf31ba2d770 call \
cli \
image \
reffunc (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()
}