Skip to main content

Manage packages using the package manager

This tutorial illustrates how to install and upgrade packages using Dagger package manager.

Installing a package

Initializing project

Create an empty directory for your new Dagger project:

mkdir project
cd project

As described in the previous tutorials, initialize your Dagger project:

dagger init
dagger new test

That will create 2 directories: .dagger and cue.mod where our package will reside:

├── cue.mod
│ ├── module.cue
│ ├── pkg
│ └── usr
├── .dagger
│ └── env
│ └── test


In our example we will use gcpcloudrun package from github Let's first add it to our source.cue file:

package main

import (

run: gcpcloudrun.#Run

To install it just run

dagger mod get

It should pull the v0.1 version from Github, leave a copy in cue.mod/pkg and reflect the change in cue.mod/dagger.mod file:

└── dagger
└── packages
└── gcpcloudrun
├── cue.mod
└── source.cue
./cue.mod/dagger.mod v0.1

Querying the current setup with dagger query should return a valid result:

"run": {
"creds": {
"username": "oauth2accesstoken"
"deploy": {
"platform": "managed",
"port": "80"
"push": {
"auth": {
"username": "oauth2accesstoken"
"push": {}


Now that you've successfully installed a package, let's try to upgrade it.

dagger mod get

You should see similar output:

12:25PM INF system | downloading

And cue.mod/dagger.mod should reflect the new version:

./cue.mod/dagger.mod v0.2

Develop package locally

Currently, package manager cannot add local packages so a workaround is linking the package to cue.mod/pkg. Create a directory with your domain name, usually, and link your package directory.

mkdir cue.mod/pkg/<mydomain>
ln -s <localpackage> cue.mod/pkg/<mydomain>/<mypackagename>