docker
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849
Entrypoint
Return Type
Docker !
Arguments
Name | Type | Description |
---|---|---|
container | [Container ! ] | image address |
digest | String ! | image digest |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 call \
--digest string
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/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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
Name | Type | Default Value | Description |
---|---|---|---|
address | String ! | - | image address |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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
Name | Type | Default Value | Description |
---|---|---|---|
tag | String ! | - | image tag |
context | Directory ! | - | context directory |
config | String ! | "apko.yaml" | config file |
arch | String | null | No description provided |
image | String ! | "chainguard/apko:latest" | apko docker image |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 call \
--digest string apko --tag string --context DIR_PATH --config string --image string
func (m *myModule) example(digest string, tag string, context *Directory, config string, image string) *Docker {
return dag.
Docker(digest).
Apko(tag, context, config, image)
}
@function
def example(digest: str, tag: str, context: dagger.Directory, config: str, image: str) -> dag.Docker:
return (
dag.docker(digest)
.apko(tag, context, config, image)
)
@func()
example(digest: string, tag: string, context: Directory, config: string, image: string): Docker {
return dag
.docker(digest)
.apko(tag, context, config, image)
}
build() 🔗
Build multi-platform image using Dockerfile
Return Type
Docker !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
context | Directory ! | - | directory context used by the Dockerfile |
dockerfile | String ! | "Dockerfile" | path to the Dockerfile to use |
platform | String | null | No description provided |
target | String ! | "" | target build stage to build |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 call \
--digest string build --context DIR_PATH --dockerfile string --target 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
Name | Type | Default Value | Description |
---|---|---|---|
container | Container | null | No description provided |
failOn | String | null | No description provided |
outputFormat | String ! | "table" | Report output formatter |
image | String ! | "chainguard/grype:latest" | Grype Docker image |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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
Name | Type | Default Value | Description |
---|---|---|---|
platformVariants | [Container ! ] | null | No description provided |
compress | Boolean | false | No description provided |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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
Name | Type | Default Value | Description |
---|---|---|---|
tag | [String ! ] ! | - | No description provided |
platformVariants | [Container ! ] | null | No description provided |
username | String | null | No description provided |
password | Secret | null | No description provided |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 call \
--digest string publish --tag string1 --tag string2
func (m *myModule) example(ctx context.Context, digest string, tag []string) string {
return dag.
Docker(digest).
Publish(ctx, tag)
}
@function
async def example(digest: str, tag: List[str]) -> str:
return await (
dag.docker(digest)
.publish(tag)
)
@func()
async example(digest: string, tag: string[]): Promise<string> {
return dag
.docker(digest)
.publish(tag)
}
sign() 🔗
Sign multi-platform image with Cosign
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
privateKey | Secret ! | - | cosign private key |
password | Secret ! | - | cosign password |
digest | String | null | No description provided |
registryUsername | String | null | No description provided |
registryPassword | Secret | null | No description provided |
dockerConfig | File | null | No description provided |
image | String ! | "chainguard/cosign:latest" | cosign docker image |
Example
dagger -m github.com/opopops/daggerverse/docker@208b9b68620ba5b94b7ff11306899742b6f06849 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)
}