docker
Build, publish, scan and sign Docker images.
Installation
dagger install github.com/opopops/docker@v0.0.5
Entrypoint
Return Type
Docker !
Arguments
Name | Type | Description |
---|---|---|
container | [Container ! ] | Image address. |
digest | String ! | Image digest. |
Example
dagger -m github.com/opopops/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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's address from its registry. |
Example
dagger -m github.com/opopops/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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 |
---|---|---|---|
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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d call \
--digest string apko --context DIR_PATH --config string --image 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
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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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 |
---|---|---|---|
address | [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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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
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/docker@21a9977a5669717dec5ef3a9b7362545ab6c0d6d 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)
}