#GoSDK+lima+nerdctl

1 messages Β· Page 1 of 1 (latest)

green ravine
#

Hi there,

I was wondering if anyone could help me run the dagger go sdk with lima+containerd.

I had dagger running with docker, but now I need to get it working with nerdctl.

Here are my specs:
Go 1.20.x
MacOS Ventura 13.3.1

I installed the previously mentioned components the following way:

$ brew install lima
$ limactl start
$ lima nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine
When I run my dagger pipeline with go run , I get the following error:
go run dagger-build/dagger.go
Building with Dagger
EOF: failed to resolve image digest: error getting credentials - err: exec: "docker-credential-osxkeychain": executable file not found in $PATH, out: ``
falling back to leftover engine
failed to list containers: exec: "docker": executable file not found in $PATH
Error: no fallback container found

Please visit https://dagger.io/help#go for troubleshooting guidance
I have also added the following line to my zshrc:
alias docker="nerdctl lima"

What do I need to do to get this going?

granite lagoon
#

cc @fading steppe was also experimenting with this

#

failed to list containers: exec: "docker": executable file not found in $PATH

this seems to be the issue. You need to add the symlink described in the docs article I posted above

stray flame
#

@green ravine yep, the alias isn't enough, def try the symlink

#

If that doesn't work, we'll figure it out. πŸ™‚

stray flame
#

I'm trying this since the doc assumes a single binary called nerdctl and you're invoking lima nerdctl:

# create a file to run lima nerdctl with args passed
sudo sh -c "echo '#\!/bin/sh' > /usr/local/bin/nerdctl"
sudo sh -c "echo 'lima nerdctl \"\$@\"' >> /usr/local/bin/nerdctl"

# make executable
sudo chmod +x /usr/local/bin/nerdctl
# symlink like in docs
sudo ln -s $(which nerdctl) /usr/local/bin/docker
stray flame
#

☝️ works for me on my M1 macbook. Hope that helps! We can add to the docs if most folks run nerdctl via lima like this.

#

cc @real drum

#

cat /usr/local/bin/nerdctl

#!/bin/sh
lima nerdctl "$@"
hollow bolt
#

maybe sorting out engine provisioning and remote engines (closely related topics) should be the next feature we add to the CLI @silent @ancient copper @frozen scarab ?

green ravine
#

Hi there,

Thanks for the help!!

So I went and added the symlink/ made nerdctl do a lima nerdctl behing the scenes.

These are the results:
`
cat /usr/local/bin/nerdctl
#!/bin/sh
lima nerdctl "$@"


which nerdctl
/usr/local/bin/nerdctl

cd /usr/local/bin/docker
ls
nerdctl
cat nerdctl
#!/bin/sh
lima nerdctl "$@"`
I also installed docker-credential-helper via homebrew, according to some threads it might get rid of the permissions issue I was seeing, and it certainly did:

go run dagger-build/dagger.go
Before:
`Building with Dagger
EOF: failed to resolve image digest: error getting credentials - err: exec: "docker-credential-osxkeychain": executable file not found in $PATH, out: ``
falling back to leftover engine
failed to list containers: exec: "docker": executable file not found in $PATH
Error: no fallback container found

Please visit https://dagger.io/help#go for troubleshooting guidance.After:go run dagger-build/dagger.go
Building with Dagger
EOF: failed to list containers: exec: "docker": executable file not found in $PATH
Error: failed to run container: : exec: "docker": executable file not found in $PATH

Please visit https://dagger.io/help#go for troubleshooting guidance.`
As you can tell, I still get the error where the docker executable is not in PATH.

I went ahead and added it to my .zshrc
export path="$PATH:/usr/local/bin/docker"
Sourced it, but still getting the same error. Any ideas as to what could be causing this and/or how to further investigate?

Again, thanks for the help.

stray flame
#

@green ravine the shebang in your script

#

guess the escapes in my shell acting differently

#
#!/bin/sh
lima nerdctl "$@"
#

vs

#
#\!/bin/sh
lima nerdctl "$@"
green ravine
#

Same error :/

stray flame
#

@green ravine screen share a little?

green ravine
#

Sure thing

frozen scarab
fading steppe
#

I'm writing a blog post about my setup running Dagger with containerd in a Firecracker microVM, in case it may help you if it's not too late when I get to publish it (hopefully early next week).

hollow bolt
stray flame
green ravine
#

Yes, thank you so much @stray flame .

If needed I can create a PR to account for nerdctl+lima.

stray flame
#

It occurred to me this morning that the workaround of the nerdctl script to run lima nerdctl seemed strange...why don't I just try to instal nerdctl with brew on my Mac M1 directly

brew install nerdctl
nerdctl: Linux is required for this software.
Error: nerdctl: An unsatisfied requirement failed this build.

Oh. That's why πŸ˜† . Carry on .

#

So our docs work for situations where you have a nerdctl binary. Like on Linux, it sounds like. The case we worked on in this thread should help folks on Darwin machines like me. #1108492190369456218 message

real drum
#

@stray flame so just to confirm the change in the guide: it's fine as is for Linux, but for Mac, the solution is a shell script that runs lima nerdctl?

#

(don't have a Mac so can't test this myself)

stray flame
#

yes, after install of lima on mac, brew install lima, i did the rest.

#

runs that script passing all args through

#

so docker ps gets run as

#

lima nerdctl ps