Skip to content

Instantly share code, notes, and snippets.

@jpadams
Last active May 25, 2023 18:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpadams/789b259cb0cf7d2a166dc4f2fa588cc5 to your computer and use it in GitHub Desktop.
Save jpadams/789b259cb0cf7d2a166dc4f2fa588cc5 to your computer and use it in GitHub Desktop.
Thanks to @busla for sharing the original script, which I've modified a bit to use our registry alias
#!/bin/bash
set -eoux pipefail
default_state_dir=/var/lib/dagger
engine_version=${1:-v0.6.0}
dagger_cache="dagger-cache"
dagger_runner="dagger"
podman volume create $dagger_cache || true
podman rm -f $dagger_runner || true
podman run \
--name $dagger_runner \
--restart always \
-d \
-v "$dagger_cache:$default_state_dir" \
--privileged \
registry.dagger.io/engine:"$engine_version" --debug
@jpadams
Copy link
Author

jpadams commented Apr 24, 2023

Telling Dagger to use the Dagger Engine running in Podman instead of starting a new one in Docker (the default)

export _EXPERIMENTAL_DAGGER_RUNNER_HOST=podman-container://dagger

@jpadams
Copy link
Author

jpadams commented Apr 24, 2023

How I installed and started Podman on my Mac M1

brew install podman
podman machine init
podman machine start

@jpadams
Copy link
Author

jpadams commented Apr 24, 2023

Now run Dagger! Say you have a Dagger program called main.go (works just as well with Python or Node.js, of course).

Note: Here's a Golang Dagger project, in case you don't have one handy with the Dagger SDK installed (https://docs.dagger.io/sdk/go/371491/install). These are ready to use 😃

# git clone https://github.com/dagger/examples
# cd examples/go/db-service

Run your Dagger pipeline program directly...

go run main.go

or run via the dagger run CLI call to get extra features like the Terminal User Interface (TUI).

Note: Install Dagger CLI v0.5.0 via brew install dagger or from releases page: https://github.com/dagger/dagger/releases/tag/v0.5.0

export _EXPERIMENTAL_DAGGER_TUI=true
dagger run go run main.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment