Skip to content

Instantly share code, notes, and snippets.

@jpadams
Last active July 29, 2024 20:34
Show Gist options
  • 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

@timblaktu
Copy link

@jpadams I got here from your comments about using dagger with podman on discord, and wanted to ask if you knew whether the latest dagger release v0.12.3 requires more than just symlinking docker-->podman client binary, which is all the documentation says is required to run with podman.

See here for more details on the problem I'm having running dagger in an environment with podman, but not docker.

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