#use podman instead of docker

1 messages · Page 1 of 1 (latest)

exotic hare
dreamy quest
#

Thanks to @zealous locust for the tips!

#

Podman is working great for me 🙂

$ podman ps                                                           git:main
CONTAINER ID  IMAGE                             COMMAND     CREATED       STATUS       PORTS       NAMES
000dfc73577c  registry.dagger.io/engine:v0.5.0  --debug     47 hours ago  Up 47 hours              dagger
#

We'll look to get this into the official docs
cc @river summit

river summit
#

Interesting. Have many users asked for this @dreamy quest ?

dreamy quest
#

So would be great to show how do this, which is pretty simple really, and give a couple of examples: perhaps podman, and nerdctl, for example.

#

I'm happy to help with this!

wraith turtle
river summit
#

Yup, I'll create an issue and add a guide for this

river summit
zealous locust
#

nice!

flint arch
#

Shouldn’t it work out of the box with podman aliased to docker? i remember we had that problem and fixed it

dreamy quest
# flint arch Shouldn’t it work out of the box with `podman` aliased to `docker`? i remember w...

Doesn't work for me via simple alias since I think we assume docker unless you are using _EXPERIMENTAL_DAGGER_RUNNER_HOST with one of these: https://github.com/dagger/dagger/blob/main/core/docs/d7yxc-operator_manual.md?plain=1#L148-L149 perhaps.

This example is for folks without Docker, but with Podman.

Here's what I get after stopping Docker Desktop and with Podman working.

First let's show that Podman works. I'm running the Dagger Engine in Podman using my Gist above.

export _EXPERIMENTAL_DAGGER_RUNNER_HOST=podman-container://dagger
go run main.go

success 🎉

Turn off any Podman stuff that I'd prepared, but leave Podman running and ready:

unset _EXPERIMENTAL_DAGGER_RUNNER_HOST
$ podman ps
CONTAINER ID  IMAGE                             COMMAND     CREATED     STATUS      PORTS       NAMES
c7a2651ed68d  registry.dagger.io/engine:v0.5.0  --debug     2 days ago  Up 2 days               dagger
$ podman rm -f c7a2651ed68d
c7a2651ed68d
$ podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES
GitHub

A programmable CI/CD engine that runs your pipelines in containers - dagger/d7yxc-operator_manual.md at main · dagger/dagger

#
$ alias docker=podman
$ which docker
docker: aliased to podman
$ go run main.go
failed to list containers: exit status 1
Error: failed to run container: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
: exit status 125
panic: EOF: failed to list containers: exit status 1
Error: failed to run container: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
: exit status 125

Please visit https://dagger.io/help#go for troubleshooting guidance.

goroutine 1 [running]:
main.main()
    /Users/jeremyadams/src/examples/go/db-service/main.go:17 +0x8b0
exit status 2
dreamy quest
flint arch
dreamy quest
#
$ docker version
Client:       Podman Engine
Version:      4.5.0
...
exotic hare
#

@dreamy quest thanks for sharing.
The dagger engine doesn't start correctly with podman, I see this error message:

    /usr/local/go/src/runtime/asm_amd64.s:1598
time="2023-04-25T07:04:30Z" level=info msg="detected mtu 1500 via interface eth0"
time="2023-04-25T07:04:30Z" level=debug msg="setting up engine tracing"
time="2023-04-25T07:04:30Z" level=debug msg="creating engine GRPC server"
time="2023-04-25T07:04:30Z" level=debug msg="creating engine lockfile"
time="2023-04-25T07:04:30Z" level=debug msg="creating engine controller"
time="2023-04-25T07:04:30Z" level=info msg="auto snapshotter: using overlayfs"
time="2023-04-25T07:04:30Z" level=debug msg="creating new network namespace np1vjo9j24ksvsavm0j2a2ezl"
time="2023-04-25T07:04:30Z" level=debug msg="releasing cni network namespace n6lc8dgvhrxpawzq8a8tk55fl"
time="2023-04-25T07:04:30Z" level=debug msg="finished creating network namespace np1vjo9j24ksvsavm0j2a2ezl"
time="2023-04-25T07:04:30Z" level=warning msg="failed to release network namespace \"n6lc8dgvhrxpawzq8a8tk55fl\" left over from previous run: plugin type=\"loopback\" failed (delete): unknown FS magic on \"/var/lib/dagger/net/cni/n6lc8dgvhrxpawzq8a8tk55fl\": ef53"
buildkitd: plugin type="bridge" failed (add): failed to list chains: running [/sbin/iptables -t nat -S --wait]: exit status 3: modprobe: can't change directory to '/lib/modules': No such file or directory
iptables v1.8.8 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

CNI setup error```
#

I'm running podman on RHEL 8.7

#

running modprobe iptable_nat on the host solved the issue.

#

everything seems to work correctly, I can start testing dagger 🥳

zealous locust
#

@flint arch yes, you helped me with that a while ago, but then noticed that I was getting errors bc of podman not able to mount to the default mnt dir (I am on Fedora Silverblue)

see here
#general message

wraith turtle
zealous locust
wraith turtle
#

👋 closing this. Feel free to re-open if needed 🙏

rustic leaf
wraith turtle
rustic leaf
wraith turtle
languid niche
#

Was anyone here using podman-only (no docker binary, only symlink to podman), and if so, did you get dagger engine to run? See the issue I just posted. Thanks!

wraith turtle
zealous locust
#

yeah, I have been using Podman to run the dagger engine since forever. Could you post the errors?

wraith turtle
zealous locust
#

not using wsl2 (Fedora Silverblue) but I am wondering what output you get if you manually run the engine with --debug

script example

#!/bin/bash

set -eoux pipefail
engine_version=${1:-v0.12.3}
dagger_runner="dagger"

usage() {
  echo "Usage: $0 [ -n NAME ] [ -t TIMES ]" 1>&2
  exit 1
}

while getopts ":he:" o; do
  case "${o}" in
  e)
    engine_version=${OPTARG}
    ;;
  :)
    echo "Error: -${OPTARG} requires an argument."
    usage
    ;;
  *)
    usage
    ;;
  esac
done

podman rm -f $dagger_runner || true

podman run \
  --name $dagger_runner \
  --restart always \
  -d \
  --privileged \
  ghcr.io/dagger/engine:"$engine_version" --debug

podman logs -f dagger
#

then run

_EXPERIMENTAL_DAGGER_RUNNER_HOST=podman-container://dagger dagger init --sdk=$sdk