#Error while trying Quickstart guide

1 messages · Page 1 of 1 (latest)

echo parrot
#

Hi all,

I've been trying the Quickstart guide (Call your first function page), but I keep getting an error which I can't understand enough to fix by myself. I've also searched here and online but failed to find a post that could help me.

Please help me get across this first hurdle!
Calling the simple "hello" function, I'd expect "Hello, World!" back, but I the trace below.

❯ dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello

✘ initialize 1.3s
  ✔ moduleSource(refString: "github.com/shykes/daggerverse/hello@v0.1.2"): ModuleSource! 0.6s
    ✔ git://github.com/shykes/daggerverse#hello/v0.1.2 0.3s
    ┃ 3d608cb5e6b4b18036a471400bc4e6c753f229d7        refs/tags/hello/v0.1.2
  ✘ ModuleSource.asModule: Module! 0.7s
    ✘ Module.withSource(
        source: ✔ moduleSource(refString: "github.com/shykes/daggerverse/hello@v0.1.2"): ModuleSource! 0.6s
      ): Module! 0.7s
      ✘ Container.directory(path: "/src"): Directory! 0.4s
        ✘ exec /usr/local/bin/codegen --module-context /src --module-name hello --propagate-logs=true --introspection-json-path /schema.json 0.4s
        ┃ runc run failed: unable to start container process: can't copy bootstrap data to pipe: write init-p: broken pipe
Error: input: moduleSource.asModule failed to create module: failed to update codegen and runtime: failed to generate code: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module-context /src --module-name hello --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1

OS: MacOS Sonoma 14.2.1 (23C71) M1 (ARM)
Dagger: dagger v0.10.0 (registry.dagger.io/engine) darwin/arm64
Go: go version go1.22.0 darwin/arm64

Call your first function

dim spindle
echo parrot
#

Yes I'm on Docker for Mac (4.27.2 (137060))

There isn't much special about my install as far as I know. I have "Access experimental features" enabled as well as "Enable Docker Extensions" and "Use containerd for pulling and storing images".

The Docker daemon config is rather straightforward:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false
}

I just gave "Reset to factory default" a try. Sadly I still get the same error.

I will try something like Orbstack to compare and get more info about what works / doesn't work

echo parrot
#

Using OrbStack didn't work at all. The Dagger Engine was crash-looping (something about not being able to set iptables).

So I reinstalled Docker Desktop and the "call hello" still gives me the error I posted.

I'll try to use the DOCKER_HOST variable to point to a Linux VM on which I was able to run the quickstart successfully. Hopefully, that'll allow me to work on my laptop 🙂

echo parrot
#

Last update for today, the Dagger CLI/engine and quickstart work just fine with the remote Docker host (linux-based).
I'll be happy to provide more details about my Docker for Mac installation if needed

dim spindle
lime tapir
lime tapir
#

@echo parrot could you please also double check you have the Rosetta feature disbled in your D4m configuration? IIRC this was the cause of similar issues in the past.

The option should be something like: Use Rosetta for x86/amd64 emulation on Apple Silicon and needs to be disabled

echo parrot
#

It doesn't work for me with Docker for Mac 4.28.0 (139021) either.

I've also tried disabling Rosetta emulation both on the version I had (4.27.x) and on the 4.28.0 version and it both cases, the Dagger engine itself (registry.dagger.io/engine:v0.10.0) crash loop.

I've attached the cash-loop logs, if they can be of any interest.

echo parrot
#

For what it's worth, I've got an older Mac available (a 2018 13-inch Intel/amd64 model) on which I just tried and was able to follow the quickstart just fine.

lime tapir
echo parrot
#

Yep

lime tapir
#

could you run docker run -it --rm --privileged --pid=host justincormack/nsenter1 in docker for mac?

#

that should give you a shell inside the docker for mac VM

#

and could you share the output of lsmod?

echo parrot
#
~ # lsmod
Module                  Size  Used by    Tainted: G
shiftfs                28672  -
selfowner              28672  -
rosetta                12288  -
grpcfuse               12288  -
fakeowner             118784  -
lime tapir
#

does modprobe iptable_nat works?

echo parrot
#

No output, but no error

~ # modprobe iptable_nat
~ # echo $?
0
```
lime tapir
#

does lsmod show it?

#

can you try re-running dagger to see if the engine starts now?

echo parrot
#

lsmod doesn't show iptable_nat.

The Dagger engine is OK at the moment on my M1 Mac because I have re-enabled Rosetta emulation.

This is the way I use Dagger at the moment : Rosetta enabled on my Mac so that the Dagger engine starts + the DOCKER_HOST variable set to a remote Linux host for the Docker engine.

lime tapir
#

Wait, when you tried by disabling Rosetta did you have the DOCKER_HOST env set?

echo parrot
#

No, though I can double-check. I am fairly certain I didn't however because I have only one shell tab with DOCKER_HOST set and docker ps in that tab shows me that the Dagger engine (on that remote machine) has been up for 11 hours.

In other words, the Dagger engines I've seen crash-looping must have been the local ones

lime tapir
#

Strange that once you disabled Rosetta the engines are still there

#

Could you just disable Rosetta and remove all your local containers?

echo parrot
#

Let me disable Rosetta again and I'll bring a new shell windows

lime tapir
#

And try again? 🙏

echo parrot
#

Alright,

I did a 'Clean/Purge' from the Docker Desktop 'Troubleshoot' tab. I've also disabled 'Use Rosetta for x86_64/amd64 emulation on Apple Silicon'.

I then fully quit Docker Desktop and restarted it.
I see that 'Use Rosetta for x86_64/amd64 emulation on Apple Silicon' is still disabled following the restart and I don't see any container in the UI and neither in

docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

(nothing below 'CREATED').

lime tapir
#

👍

#

yep, let's see what happens

echo parrot
#
docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
❯ dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello
● connect 26.1s
┃ 55df5f9e19b2: Pull complete
┃ bd322487e5e0: Pull complete
┃ f0edabcd094b: Pull complete
┃ a861695c98ae: Pull complete
┃ eb659c20a8ce: Pull complete
┃ 39bacb26d45b: Pull complete
┃ 4f4fb700ef54: Pull complete
┃ c0021648fa0d: Pull complete
┃ Digest: sha256:29b256a18722af4f20ec785af9c6b29e58af90223d5379893d5ac4debfb38269
┃ Status: Downloaded newer image for registry.dagger.io/engine:v0.10.0
┃ registry.dagger.io/engine:v0.10.0
┃
┃ What's Next?
┃   View a summary of image vulnerabilities and recommendations → docker scout quickview registry.dagger.io/engine:v0.10.0

connect 41 seconds and counting.

In another tab:

❯ echo $DOCKER_HOST

❯ docker ps -a
CONTAINER ID   IMAGE                               COMMAND                  CREATED              STATUS                          PORTS     NAMES
9996d91b82d0   registry.dagger.io/engine:v0.10.0   "dagger-entrypoint.s…"   About a minute ago   Restarting (1) 16 seconds ago             dagger-engine-29b256a18722af4f
❯
lime tapir
#

yeah.. seems crashlooping.. I'd assume same iptables message?

echo parrot
#

Yes.
Shall I jump in the Docker VM shell again to list the mods & such?

lime tapir
#

yes please if you don't mind 🙏

echo parrot
#

Weird, I get this (the pull of the image is normal, it's the last line that puzzles me):

❯ docker run -it --rm --privileged --pid=host justincormack/nsenter1
Unable to find image 'justincormack/nsenter1:latest' locally
latest: Pulling from justincormack/nsenter1
5bc638ae6f98: Pull complete
Digest: sha256:e876f694a4cb6ff9e6861197ea3680fe2e3c5ab773a1e37ca1f13171f7f5798e
Status: Downloaded newer image for justincormack/nsenter1:latest
setns:mnt: Invalid argument
lime tapir
#

brb

lime tapir
#

how about this? nc -U ~/Library/Containers/com.docker.docker/Data/debug-shell.sock

does that work?

#

seems like there could have been an update in docker for mac which caused our engine to stop working. I'm not on a mac, but big part of the team is. I'll open an issue in any case to keep investigating

echo parrot
#

Oh my.. give me a minute to check something 🫢

#

I build and ship Docker images intended for Linux VMs on a daily basis. As a convenience, I'm exporting DOCKER_DEFAULT_PLATFORM=amd64 as part of my .zshrc.

I thought this could have been the issue.

❯ echo $DOCKER_DEFAULT_PLATFORM
linux/amd64
❯ unset DOCKER_DEFAULT_PLATFORM
❯ echo $DOCKER_DEFAULT_PLATFORM

❯ docker run -it --rm --privileged --pid=host justincormack/nsenter1
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
setns:mnt: Invalid argument
lime tapir
#

oh, in that case can you remove the engine container

#

and try running the dagger call again?

#

oh nvm.. that shouldn't change anything

#

since the engine will not read that variable 🤔

lime tapir
echo parrot
#

Yeah, same thing even if I remove the variables & engine container

❯ echo $DOCKER_HOST

❯ echo $DOCKER_DEFAULT_PLATFORM

❯ docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

❯ dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello
∅ connect 56.0s

Error: context canceled
#

I'll log out for tonight, but feel free to reach if you need aditionnal information or testing

lime tapir
echo parrot
#

Sure

lime tapir
#

1 sec

#

docker run --privileged -v /var/lib/dagger registry.dagger.io/engine@sha256:29bc2b61e72100cdb4caf81d2aa163b3f6590a322bcb50b0c87e38e8f0c1af3e

#

I'd assume that will give you the same error of the iptables thing 🤞

echo parrot
#

No, that one works for me. It created all the network namespaces and is still up & running.

I was able to call the hello function from another shell with that Engine/container up:
❯ dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello
hello, world!

lime tapir
#

🤔 in that case I think your docker for mac has some weird config besides the DOCKER_DEFAULT_PLATFORM somewhere which is causing your containers to run amd64 instead of arm

#

the image that I've sent you above is the arm64 version of the engine

#

that's why it worked in this case

#

hmmm.. if you do docker ps how many engines do you have running now?

lime tapir
echo parrot
#

I have two

lime tapir
lime tapir
# echo parrot I have two

ok, and the second (which is the one you didn't start) seems to have started successfully now 🤔

#

that's probably the one that your dagger call used

echo parrot
#

Yeah. It's getting late, but tomorrow I'll move aside my .zshrc config file to try to use a "vanilla" ZSH. I'll also clean & purge the Docker data and images to start these tests from scratch

lime tapir
#

👍

#

sure

#

anyways.. glad we managed to make it work

#

🎉

echo parrot
#

Many thanks for the help, that was a weird one and even though we kind of understand why it wasn't working, I still want to find the exact cause of it

lime tapir
#

sure, don't hesitate to write back if you still can't find it

echo parrot
#

Thanks again, and have a great day/night

lime tapir
echo parrot
#

I can confirm that after removing the DOCKER_DEFAULT_PLATFORM variable, restarting my shell(s), and recreating the Dagger engine container, everything now works as expected.

My understanding is that even if the Dagger engine itself manages to start correctly at first with DOCKER_DEFAULT_PLATFORM set to another platform, the other processes spawned by the engine to run commands such as call hello themselves cannot work in this "cross-platform" configuration. Though the error was sure really confusing and unindicating of the real issue.

I understand what happened and why it happened. I'll see how I want to handle this in the future. I must say that DOCKER_DEFAULT_PLATFORM variable was quite convenient for me and I'd rather keep it instead of setting the --platform argument each time I run docker build.

What I'm think it to manage the way that the Dagger engine is started (eg: a small function in zshrc to check the state of the engine and start it, without the DOCKER_DEFAULT_PLATFORM variable if it isn't started).

Thanks again for all the support 🙂

lime tapir
naive ledge
naive ledge
#

Still a nogo for me. odd.

naive ledge
#

@lime tapir

lime tapir
naive ledge
#

yup 🙂

#

I don't have DOCKER_DEFAULT_PLATFORM or any of the other vars set in my installation. A buddy of mine was having issues in WSL now too I believe. about to confirm with him. He's been working with dagger for ~2 years or so.

We're about to teach a workshop here in raleigh in about 2 weeks and just happened to run into it when going through the docs.

lime tapir
naive ledge
#

all good, no rush

lime tapir
#

your host OS is Windows I'd assume?

naive ledge
#

MacOS

lime tapir
#

👍

#

and you have rosetta disabled in Docker desktop, right?

naive ledge
#

it's disabled yea

#

and I removed all previous dagger images and running containers.

lime tapir
#

👍

naive ledge
#

what timezone are you in ?

#

I have a meeting now, will ping in 30 minutes.

leaden edge
#

@lime tapir I added https://github.com/dagger/dagger/pull/6865 for your review based on the previous discussion with @echo parrot - please see if anything further should be added to clarify the problem description? Also, maybe some of the info in that PR will be helpful for troubleshooting @naive ledge's issue?

naive ledge
#

sure thanks.

#

sorry, got sidetracked with something else.

#

Will take a look thanks!

lime tapir
#

@naive ledge have 30m now if you can spare the time

lime tapir
#

I'm out for today, let's try tomorrow if you're still struggling with this as I'll have more time 🙏

naive ledge
#

yes, still having the issue, just had back to back meetings the last few days + travel.

#

I'll ping you when I'm free. Thanks @lime tapir

lime tapir
slate crane
#

@naive ledge - just hopping in to let you know I see your messages. @lime tapir I will be at the Dagger meetup with Gary later this month.

I think I ran into this issue before. Let me try to repro on my M1.

slate crane
#

This doesn't repro for me.

naive ledge
#

I'll repro again today.

#

@lime tapir 🙂

#

I'm back in town now, sorry for the delay here.

lime tapir
#

Hey @naive ledge ! I was at kubecon this week and I'll be off next week. @slate crane @marsh pelican would you help me by following up this thread please🙏

marsh pelican
naive ledge
#

Let's shoot for Tuesday 🙂