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/stuttgart-things/dagger/docker@v0.6.4
Entrypoint
Return Type
Docker !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
baseHadolintContainer | Container | - | base hadolint container It need contain hadolint |
baseTrivyContainer | Container | - | base hadolint container It need contain hadolint |
buildContainer | Container | - | The external build of container Usefull when need build args |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
func (m *myModule) example() *Docker {
return dag.
Docker()
}
@function
def example() -> dag.Docker:
return (
dag.docker()
)
@func()
example(): Docker {
return dag
.docker()
}
Types
Docker 🔗
baseTrivyContainer() 🔗
Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
base-trivy-container
func (m *myModule) example() *Container {
return dag.
Docker().
BaseTrivyContainer()
}
@function
def example() -> dagger.Container:
return (
dag.docker()
.base_trivy_container()
)
@func()
example(): Container {
return dag
.docker()
.baseTrivyContainer()
}
trivyScan() 🔗
TrivyScan performs a security scan on a Docker image using its reference
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
imageRef | String ! | - | Fully qualified image reference (e.g., "ttl.sh/my-repo:1.0.0") |
withRegistryUsername | Secret | - | The registry username |
withRegistryPassword | Secret | - | The registry password |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
trivy-scan --image-ref string
func (m *myModule) example(ctx context.Context, imageRef string) string {
return dag.
Docker().
TrivyScan(ctx, imageRef)
}
@function
async def example(image_ref: str) -> str:
return await (
dag.docker()
.trivy_scan(image_ref)
)
@func()
async example(imageRef: string): Promise<string> {
return dag
.docker()
.trivyScan(imageRef)
}
lint() 🔗
Lint permit to lint dockerfile image
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory ! | - | the source directory |
dockerfile | String | - | The dockerfile path |
threshold | String | - | The failure threshold |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
lint --source DIR_PATH
func (m *myModule) example(ctx context.Context, source *Directory) string {
return dag.
Docker().
Lint(ctx, source)
}
@function
async def example(source: dagger.Directory) -> str:
return await (
dag.docker()
.lint(source)
)
@func()
async example(source: Directory): Promise<string> {
return dag
.docker()
.lint(source)
}
getBaseHadolintContainer() 🔗
GetBaseHadolintContainer return the default image for hadolint
Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
get-base-hadolint-container
func (m *myModule) example() *Container {
return dag.
Docker().
GetBaseHadolintContainer()
}
@function
def example() -> dagger.Container:
return (
dag.docker()
.get_base_hadolint_container()
)
@func()
example(): Container {
return dag
.docker()
.getBaseHadolintContainer()
}
getTrivyContainer() 🔗
GetBaseHadolintContainer return the default image for hadolint
Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
get-trivy-container
func (m *myModule) example() *Container {
return dag.
Docker().
GetTrivyContainer()
}
@function
def example() -> dagger.Container:
return (
dag.docker()
.get_trivy_container()
)
@func()
example(): Container {
return dag
.docker()
.getTrivyContainer()
}
buildAndPush() 🔗
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory ! | - | The source directory |
repositoryName | String ! | - | The repository name |
version | String ! | - | The version |
withRegistryUsername | Secret | - | The registry username |
withRegistryPassword | Secret | - | The registry password |
registryUrl | String ! | - | The registry URL |
dockerfile | String | "Dockerfile" | The Dockerfile path |
withDirectories | [Directory ! ] | - | Set extra directories |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
build-and-push --source DIR_PATH --repository-name string --version string --registry-url string
func (m *myModule) example(ctx context.Context, source *Directory, repositoryName string, version string, registryUrl string) string {
return dag.
Docker().
BuildAndPush(ctx, source, repositoryName, version, registryUrl)
}
@function
async def example(source: dagger.Directory, repository_name: str, version: str, registry_url: str) -> str:
return await (
dag.docker()
.build_and_push(source, repository_name, version, registry_url)
)
@func()
async example(source: Directory, repositoryName: string, version: string, registryUrl: string): Promise<string> {
return dag
.docker()
.buildAndPush(source, repositoryName, version, registryUrl)
}
build() 🔗
Build permit to build image from Dockerfile
Return Type
ImageBuild !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory ! | - | the source directory |
dockerfile | String | "Dockerfile" | The dockerfile path |
withDirectories | [Directory ! ] | - | Set extra directories |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
build --source DIR_PATH
func (m *myModule) example(source *Directory) *DockerImageBuild {
return dag.
Docker().
Build(source)
}
@function
def example(source: dagger.Directory) -> dag.DockerImageBuild:
return (
dag.docker()
.build(source)
)
@func()
example(source: Directory): DockerImageBuild {
return dag
.docker()
.build(source)
}
ImageBuild 🔗
getContainer() 🔗
GetContainer permit to get the container
Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
build --source DIR_PATH \
get-container
func (m *myModule) example(source *Directory) *Container {
return dag.
Docker().
Build(source).
GetContainer()
}
@function
def example(source: dagger.Directory) -> dagger.Container:
return (
dag.docker()
.build(source)
.get_container()
)
@func()
example(source: Directory): Container {
return dag
.docker()
.build(source)
.getContainer()
}
push() 🔗
Push permits pushing an image to a registry, with support for insecure registries
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repositoryName | String ! | - | The repository name |
version | String ! | - | The version |
withRegistryUsername | Secret | - | The registry username |
withRegistryPassword | Secret | - | The registry password |
registryUrl | String ! | - | The registry URL |
Example
dagger -m github.com/stuttgart-things/dagger/docker@ea420e9ca80329a3681864d4eac44702e2a32e78 call \
build --source DIR_PATH \
push --repository-name string --version string --registry-url string
func (m *myModule) example(ctx context.Context, source *Directory, repositoryName string, version string, registryUrl string) string {
return dag.
Docker().
Build(source).
Push(ctx, repositoryName, version, registryUrl)
}
@function
async def example(source: dagger.Directory, repository_name: str, version: str, registry_url: str) -> str:
return await (
dag.docker()
.build(source)
.push(repository_name, version, registry_url)
)
@func()
async example(source: Directory, repositoryName: string, version: string, registryUrl: string): Promise<string> {
return dag
.docker()
.build(source)
.push(repositoryName, version, registryUrl)
}