Is it possible to keep services alive when using interactive mode? Would be very helpful for debugging.
This example uses a service and throws an error. The debug shell works, but the service is gone.
// interactive shell looses the service dependency currently (0.15.1)
func (m *Treasury) ExperimentWithService(
ctx context.Context,
) (string, error) {
service := dag.Container().
From("python").
WithWorkdir("/srv").
WithNewFile("index.html", "Hello, world!").
WithExposedPort(8080).
AsService(dagger.ContainerAsServiceOpts{Args: []string{"python", "-m", "http.server", "8080"}})
out, err := dag.Container().
From("alpine").
WithServiceBinding("www", service).
// use service
WithExec([]string{"wget", "-O-", "http://www:8080"}).
// cause error
WithExec([]string{"false"}).
Stdout(ctx)
return out, err
}
I run with dagger -i -v call experiment-with-service
But then inside the debug shell, I the www is gone.
/ # wget http://www:8080
wget: bad address 'www:8080'
/ # cat /etc/hosts
127.0.0.1 localhost buildkitsandbox
::1 localhost ip6-localhost ip6-loopback
/ #