Dagger
Search

docker

Build, publish, scan and sign Docker images.

Installation

dagger install github.com/opopops/docker@v0.0.2

Entrypoint

Return Type
Docker !
Arguments
NameTypeDescription
container[Container ! ] Image address.
digestString !Image digest.
Example
func (m *myModule) example(digest string) *Docker  {
	return dag.
			Docker(digest)
}
@function
def example(digest: str) -> dag.Docker:
	return (
		dag.docker(digest)
	)
@func()
example(digest: string): Docker {
	return dag
		.docker(digest)
}

Types

Docker

Docker module

container()

Image address.

Return Type
[Container ! ] !
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string container
func (m *myModule) example(digest string) []*Container  {
	return dag.
			Docker(digest).
			Container()
}
@function
def example(digest: str) -> List[dagger.Container]:
	return (
		dag.docker(digest)
		.container()
	)
@func()
example(digest: string): Container[] {
	return dag
		.docker(digest)
		.container()
}

digest()

Image digest.

Return Type
String !
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string digest
func (m *myModule) example(ctx context.Context, digest string) string  {
	return dag.
			Docker(digest).
			Digest(ctx)
}
@function
async def example(digest: str) -> str:
	return await (
		dag.docker(digest)
		.digest()
	)
@func()
async example(digest: string): Promise<string> {
	return dag
		.docker(digest)
		.digest()
}

import()

Import a Doker image

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
addressString !-Image's address from its registry.
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string import --address string
func (m *myModule) example(digest string, address string) *Container  {
	return dag.
			Docker(digest).
			Import(address)
}
@function
def example(digest: str, address: str) -> dagger.Container:
	return (
		dag.docker(digest)
		.import_(address)
	)
@func()
example(digest: string, address: string): Container {
	return dag
		.docker(digest)
		.import(address)
}

apko()

Build multi-platform image using Chainguard apko tool (apk-based OCI image builder).

Return Type
Docker !
Arguments
NameTypeDefault ValueDescription
contextDirectory !-Directory context used by apko.
configString !"apko.yaml"apko config file.
archString nullNo description provided
imageString !"chainguard/apko:latest"apko Docker image.
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string apko --context DIR_PATH --config string --image string \
 import --address string
func (m *myModule) example(digest string, context *Directory, config string, image string) *Docker  {
	return dag.
			Docker(digest).
			Apko(context, config, image)
}
@function
def example(digest: str, context: dagger.Directory, config: str, image: str) -> dag.Docker:
	return (
		dag.docker(digest)
		.apko(context, config, image)
	)
@func()
example(digest: string, context: Directory, config: string, image: string): Docker {
	return dag
		.docker(digest)
		.apko(context, config, image)
}

build()

Build multi-platform image using Dockerfile.

Return Type
Docker !
Arguments
NameTypeDefault ValueDescription
contextDirectory !-Directory context used by the Dockerfile.
dockerfileString !"Dockerfile"Path to the Dockerfile to use.
platformString nullNo description provided
targetString !""Target build stage to build.
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string build --context DIR_PATH --dockerfile string --target string \
 import --address string
func (m *myModule) example(digest string, context *Directory, dockerfile string, target string) *Docker  {
	return dag.
			Docker(digest).
			Build(context, dockerfile, target)
}
@function
def example(digest: str, context: dagger.Directory, dockerfile: str, target: str) -> dag.Docker:
	return (
		dag.docker(digest)
		.build(context, dockerfile, target)
	)
@func()
example(digest: string, context: Directory, dockerfile: string, target: string): Docker {
	return dag
		.docker(digest)
		.build(context, dockerfile, target)
}

scan()

Scan image with Grype and return the formatted report

Return Type
String !
Arguments
NameTypeDefault ValueDescription
containerContainer nullNo description provided
failOnString nullNo description provided
outputFormatString !"table"Report output formatter.
imageString !"chainguard/grype:latest"Grype Docker image.
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string scan --output-format string --image string
func (m *myModule) example(ctx context.Context, digest string, outputFormat string, image string) string  {
	return dag.
			Docker(digest).
			Scan(ctxoutputFormat, image)
}
@function
async def example(digest: str, output_format: str, image: str) -> str:
	return await (
		dag.docker(digest)
		.scan(output_format, image)
	)
@func()
async example(digest: string, outputFormat: string, image: string): Promise<string> {
	return dag
		.docker(digest)
		.scan(outputFormat, image)
}

export()

Export image as tarball.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
platformVariants[Container ! ] nullNo description provided
compressBoolean falseNo description provided
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string export
func (m *myModule) example(digest string) *File  {
	return dag.
			Docker(digest).
			Export()
}
@function
def example(digest: str) -> dagger.File:
	return (
		dag.docker(digest)
		.export()
	)
@func()
example(digest: string): File {
	return dag
		.docker(digest)
		.export()
}

publish()

Publish multi-platform image.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
address[String ! ] !-No description provided
platformVariants[Container ! ] nullNo description provided
usernameString nullNo description provided
passwordSecret nullNo description provided
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string publish --address string1 --address string2
func (m *myModule) example(ctx context.Context, digest string, address []string) string  {
	return dag.
			Docker(digest).
			Publish(ctx, address)
}
@function
async def example(digest: str, address: List[str]) -> str:
	return await (
		dag.docker(digest)
		.publish(address)
	)
@func()
async example(digest: string, address: string[]): Promise<string> {
	return dag
		.docker(digest)
		.publish(address)
}

sign()

Sign multi-platform image with Cosign.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
privateKeySecret !-Cosign private key.
passwordSecret !-Cosign password.
digestString nullNo description provided
registryUsernameString nullNo description provided
registryPasswordSecret nullNo description provided
dockerConfigFile nullNo description provided
imageString !"chainguard/cosign:latest"Cosign Docker image.
Example
dagger -m github.com/opopops/docker@230c9f3121bd02566d86766fd333d65c97166454 call \
 --digest string sign --private-key env:MYSECRET --password env:MYSECRET --image string
func (m *myModule) example(ctx context.Context, digest string, privateKey *Secret, password *Secret, image string) string  {
	return dag.
			Docker(digest).
			Sign(ctx, privateKey, password, image)
}
@function
async def example(digest: str, private_key: dagger.Secret, password: dagger.Secret, image: str) -> str:
	return await (
		dag.docker(digest)
		.sign(private_key, password, image)
	)
@func()
async example(digest: string, privateKey: Secret, password: Secret, image: string): Promise<string> {
	return dag
		.docker(digest)
		.sign(privateKey, password, image)
}