#I am running dagger in dagger to test a
1 messages · Page 1 of 1 (latest)
I suspect the issue is related to the way I am trying to run dind using modules, I am going to give it a try using the dockerd module
Here is a simple reproduction though
// QA for Dagger Docs
package main
import (
"context"
)
type Qa struct{}
// run all test cases from dagger docs
func (m *Qa) Test(dir *Directory) (string, error) {
ctx := context.Background()
// defer dag.Close()
docker := dag.Container().
From("docker:dind").
WithMountedCache("/var/lib/docker", dag.CacheVolume("dind")).
WithExec([]string{
"dockerd",
"--tls=false",
"--host=tcp://0.0.0.0:2375",
}, ContainerWithExecOpts{
InsecureRootCapabilities: true,
}).
WithExposedPort(2375).
AsService()
return dag.Container().From("python:3.11-slim-buster").
WithServiceBinding("docker", docker).
WithEnvVariable("DOCKER_HOST", "tcp://docker:2375").
WithExec([]string{"apt", "update"}).
WithExec([]string{"apt", "install", "-y", "curl", "git"}).
WithExec([]string{"sh", "-c", "curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.10.1 BIN_DIR=/usr/local/bin sh"}).
WithExec([]string{"sh", "-c", "curl -fsSL https://get.docker.com | sh"}).
WithExec([]string{"sh", "-c", "dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello"}).
Stdout(ctx)
}
Hm, running with the dockerd module runs into the same issue 😦
So to be clear I am trying to test a dagger module by executing it inside of a container as a part of a test suite.
// QA for Dagger Docs
package main
import (
"context"
)
type Qa struct{}
// run all test cases from dagger docs
func (m *Qa) Test(dir *Directory) (string, error) {
ctx := context.Background()
// defer dag.Close()
return dag.Container().From("python:3.11-slim-buster").
WithExec([]string{"apt", "update"}).
WithExec([]string{"apt", "install", "-y", "curl", "git"}).
WithExec([]string{"sh", "-c", "curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.10.1 BIN_DIR=/usr/local/bin sh"}).
WithExec([]string{"sh", "-c", "dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello"}, ContainerWithExecOpts{ExperimentalPrivilegedNesting: true}).
Stdout(ctx)
}
Does that work?
You shoudn't need docker and it may be resulting in something weird
@civic tulip have you tried removing your dagger engine container and trying again?
I think I saw this issue before when the dagger engine container loses internet connectivity for some weird docker issues
also checking the engine logs might also unveil what's happening here
@fair lantern wait why do you say I don't need docker -- sorry I am confused because when I try it without docker it fails because it cannot run the dagger module without a place to run the engine
So this does work now haha
But I have no idea how -- and why it wasn't before :/
ExperimentalPrivilegedNesting is the key part above, it gives the exec access back to the engine its running in
Oooooooh
That is so much cleaner, I had no idea this was a thing. Thank you so much!
it could have been the connectivity issue I was seeing in some other user reports
thanks but I mean the thing that Erik showed me works (without using docker at all)
oh! ok, that makes sense...
You are my hero @fair lantern -- not only does this work, its even better than what I had before because it allows me to see all of the dagger activity of the underlying modules that I am callcing using the pretty TUI
Before, when I ran it manually (using just pytest) it would revert to the plain format.
awesome! yeah it's not something we doc really since its mostly only useful for dagger's own ci, but very useful for these types of situations