Skip to main content

Calling Functions

dagger check, dagger generate, and dagger up are conveniences built on top of the underlying primitive: calling a module's functions. When you need something those verbs don't cover, call functions directly.

dagger api call jest test

Discover functions

List the functions available in your workspace:

dagger api functions

List the functions on a specific module:

dagger api functions jest

Every function and its arguments are also visible through --help:

dagger api call jest --help

Pass arguments

Arguments are flags on the function that accepts them:

dagger api call jest --package-manager=yarn test

Secrets are passed the same way, via provider URIs — see Secrets:

dagger api call deploy --token=env:DEPLOY_TOKEN

Chain functions

Functions interconnect into a pipeline. Each function returns an object, and the next function is called on that result:

dagger -m core api call container \
from --address=alpine \
with-exec --args=echo,hello \
stdout

Output

By default the result is printed to your terminal. Format it as JSON:

dagger api call jest test --json

Or save a returned file or directory to the host:

dagger api call build --output=./dist