---
slug: /user/quickstart/623939/call
hide_table_of_contents: true
title: "Execute functions in a module"
---

# Quickstart

## Execute functions in a module

The `dagger call` command lets you interact with a module. It executes a function and shows you the output.

This is especially useful for running tasks that only output simple types (such as strings) or that perform some work (such as a deployment).

### Execute functions

You've already seen that the example module has a `test` function to run the application's tests. Use the `dagger call` function to invoke it:

```shell
dagger call test
```

Here's an example of the output:

```shell
✔ dagger call test [8m51.3s]
┃ PASS src/App.test.tsx
┃   ✓ renders learn dagger link (58 ms)
┃
┃ Test Suites: 1 passed, 1 total
┃ Tests:       1 passed, 1 total
┃ Snapshots:   0 total
┃ Time:        4.892 s
┃ Ran all test suites.
```

This module also has a `build` function, which builds the application and returns the directory containing the application's web assets ready to be served by an HTTP server. Call this `build` function and verify that the application builds successfully:

```shell
dagger call build
```

The output of the function call is the build directory contents. Here's an example of the output:

```shell
✔ dagger call build [1m22.5s]
┃ asset-manifest.json
┃ favicon.ico
┃ index.html
┃ logo192.png
┃ logo512.png
┃ manifest.json
┃ robots.txt
┃ static
```

The module also has a `publish-container` function that pushes a container containing the built application to [ttl.sh](https://ttl.sh), an ephemeral Docker registry. Use it as below:

```shell
dagger call publish-container
```

The container image is published with a random name and printed to the console, as in the example output below:

```shell
✔ dagger call publish-container [1m5.6s]
┃ ttl.sh/sharp_jemison:10m@sha256:07a5b64ab41ef38a8a5b68294a64a95817352ea7edaf7e
┃ a50ceacd67bb2278a4
```

### Execute functions with arguments

The `dagger call` command (and all other commands) can accept arguments, which can be required or optional. To see the list of arguments a function accepts, call it with the `--help` argument:

```shell
dagger call test --help
```

Add an argument to run the tests with a different version of Node.js:

```shell
dagger call test --node-version 18
```

### Use modules from remote sources

Modules don't need to be installed locally. Dagger lets you consume modules from remote sources as well. For example, you can `dagger call` a function from a module using its GitHub URL:

```shell
dagger call -m "github.com/sipsma/daggerverse@main" test
```

Or, if the target module is in a subdirectory of the repository:

```shell
dagger call -m "github.com/sipsma/daggerverse/example@main" test
```

You can also use modules from the local filesystem, without needing to push them to GitHub. For example:

```shell
dagger call -m "./path/to/module" test
```

:::tip
The [Daggerverse](https://daggerverse.dev) is an online catalog of Dagger modules that enables users to easily discover and use modules created by the Dagger community.

Here are a few examples of using this command with modules from the [Daggerverse](https://daggerverse.dev/):

- `dagger call -m github.com/jpadams/daggerverse/trivy scan-image --image-ref alpine/git:latest`
  - Module information: https://daggerverse.dev/mod/github.com/jpadams/daggerverse/trivy@d444ed56169d3737c018ed16e2d6bab92886f951
- `dagger call -m github.com/shykes/daggerverse/ttlsh publish --ctr alpine:latest`
  - Module information: https://daggerverse.dev/mod/github.com/shykes/daggerverse/ttlsh@16e40ec244966e55e36a13cb6e1ff8023e1e1473
:::
