Skip to main content

CLI Reference

dagger

The Dagger CLI provides a command-line interface to Dagger.

Options

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

dagger call

Call a module function

Synopsis

Call a module function and print the result.

If the last argument is either a Container, Directory, or File, the pipeline will be evaluated (the result of calling sync) without presenting any output. Providing the --output option (shorthand: -o) is equivalent to calling export instead. To print a property of these core objects, continue chaining by appending it to the end of the command (for example, stdout, entries, or contents).

dagger call [options]

Examples

dagger call test
dagger call build -o ./bin/myapp
dagger call lint stdout

Options

      --json            Present result as JSON
-m, --mod string Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")
-o, --output string Path in the host to save the result to

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger config

Get or set the configuration of a Dagger module

Synopsis

Get or set the configuration of a Dagger module. By default, print the configuration of the specified module.

dagger config [options]

Examples

dagger config -m /path/to/some/dir
dagger config -m github.com/dagger/hello-dagger

Options

      --json         output in JSON format
-m, --mod string Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger develop

Setup or update all the resources needed to develop on a module locally

Synopsis

Setup or update all the resources needed to develop on a module locally.

This command regenerates the module's code based on dependencies and the current state of the module's source code.

If --sdk is set, the config file and generated code will be updated with those values reflected. It currently can only be used to set the SDK of a module that does not have one already.

--source allows controlling the directory in which the actual module source code is stored. By default, it will be stored in a directory named "dagger".

note

If not updating source or SDK, this is only required for IDE auto-completion/LSP purposes.

dagger develop [options]

Options

  -m, --mod string      Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")
--sdk string New SDK for the module
--source string Directory to store the module implementation source code in

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger functions

List available functions

Synopsis

List available functions in a module.

This is similar to dagger call --help, but only focused on showing the available functions.

dagger functions [options] [function]...

Options

  -m, --mod string   Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger init

Initialize a new Dagger module

Synopsis

Initialize a new Dagger module in a local directory. By default, create a new dagger.json configuration in the current working directory. If the positional argument PATH is provided, create the module in that directory instead.

The configuration will default the name of the module to the parent directory name, unless specified with --name.

Any module can be installed to via "dagger install".

A module can only be called once it has been initialized with an SDK though. The "--sdk" flag can be provided to init here, but if it's not the configuration can be updated later via "dagger develop".

The "--source" flag allows controlling the directory in which the actual module source code is stored. By default, it will be stored in a directory named "dagger".

dagger init [options] [path]

Examples

dagger init --name=hello --sdk=python --source=some/subdir

Options

      --license string   License identifier to generate - see https://spdx.org/licenses/
--name string Name of the new module (defaults to parent directory name)
--sdk string Optionally initialize module for development in the given SDK
--source string Directory to store the module implementation source code in (defaults to "dagger/ if "--sdk" is provided)

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger install

Add a new dependency to a Dagger module

Synopsis

Add a Dagger module as a dependency of a local module.

dagger install [options] <module>

Examples

dagger install github.com/shykes/daggerverse/ttlsh@16e40ec244966e55e36a13cb6e1ff8023e1e1473

Options

  -m, --mod string    Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")
-n, --name string Name to use for the dependency in the module. Defaults to the name of the module being installed.

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger login

Log in to Dagger Cloud

dagger login [options] [org]

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger logout

Log out from Dagger Cloud

dagger logout

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger query

Send API queries to a dagger engine

Synopsis

Send API queries to a dagger engine.

When no document file is provided, reads query from standard input.

Can optionally provide the GraphQL operation name if there are multiple queries in the document.

dagger query [options] [operation]

Examples

dagger query <<EOF
{
container {
from(address:"hello-world") {
withExec(args:["/hello"]) {
stdout
}
}
}
}
EOF

Options

      --doc string        Read query from file (defaults to reading from stdin)
-m, --mod string Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g. "github.com/dagger/dagger/path/to/some/subdir")
--var strings List of query variables, in key=value format
--var-json string Query variables in JSON format (overrides --var)

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger run

Run a command in a Dagger session

Synopsis

Executes the specified command in a Dagger Session and displays live progress in a TUI.

DAGGER_SESSION_PORT and DAGGER_SESSION_TOKEN will be conveniently injected automatically.

For example:

jq -n '{query:"{container{id}}"}' | \
dagger run sh -c 'curl -s \
-u $DAGGER_SESSION_TOKEN: \
-H "content-type:application/json" \
-d @- \
http://127.0.0.1:$DAGGER_SESSION_PORT/query'
dagger run [options] <command>...

Examples

dagger run go run main.go
dagger run node index.mjs
dagger run python main.py

Options

      --cleanup-timeout duration   max duration to wait between SIGTERM and SIGKILL on interrupt (default 10s)
--focus Only show output for focused commands.

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.

dagger version

Print dagger version

dagger version

Options inherited from parent commands

  -d, --debug             show debug logs and full verbosity
--progress string progress output format (auto, plain, tty) (default "auto")
-s, --silent disable terminal UI and progress output
-v, --verbose count increase verbosity (use -vv or -vvv for more)

SEE ALSO

  • dagger - The Dagger CLI provides a command-line interface to Dagger.