Dagger
Search

utils

This file contains the container utils module, which is a set of functions that can be used to modify a container and enhance its functionality in different ways.

Installation

dagger install github.com/marcosnils/daggerverse/utils@v0.2.7

Entrypoint

Return Type
Utils
Example
func (m *myModule) example() *Utils  {
	return dag.
			Utils()
}
@function
def example() -> dag.Utils:
	return (
		dag.utils()
	)
@func()
example(): Utils {
	return dag
		.utils()
}

Types

Utils

withCommands()

WithCommands takes a container and a slice of command arguments and returns a new container with the specified commands. It generates a shell script based on the provided commands and sets it as the entrypoint for the container. The commands are executed when the container is started.

If the bash executable is not present, an error will be returned.

Parameters: - c: The original container. - cmds: A slice of command arguments. Each command is represented as a slice of strings.

Returns: - A new container with the specified commands. - An error if the bash executable is not present.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
cContainer !-No description provided
cmds[List ! ] !-No description provided
Example
dagger -m github.com/marcosnils/daggerverse/utils@bfa9939333c74e5b74a7a3281d9a3fad729fba49 call \
 with-commands --c IMAGE:TAG --cmds list1 --cmds list2
func (m *myModule) example(c *Container, cmds []) *Container  {
	return dag.
			Utils().
			WithCommands(c, cmds)
}
@function
def example(c: dagger.Container, cmds: List[]) -> dagger.Container:
	return (
		dag.utils()
		.with_commands(c, cmds)
	)
@func()
example(c: Container, cmds: []): Container {
	return dag
		.utils()
		.withCommands(c, cmds)
}