I have a container that I use to start up as a service. Once that service is running, I need to continue using that container in order to initialize the service. I use WithServiceBinding in that container, and that all works fine.
I have another container which talks to that service, but I need to ensure that it doesn't run until after the service is fully initialized. So, WithServiceBinding isn't sufficient -- I need to express a dependency on the other container.
Here is some pseudo-Go code for what I am doing:
// Create the service container.
c1 := dag.Container().From("...")
// Start the service. Error handling elided.
svc, err := c1.AsService().Start(ctx)
// Continue using the container to run a command to initialize the service.
// Error handling elided again.
output, err := c1.WithServiceBinding("svc", svc).WithExec(...).Stderr(ctx)
// Create the second container, which depends not only on the service running, but on c1 having run.
c2 := dag.Container().From("...").WithServiceBinding("svc", svc).WithExec(...)
output, err := c2.Stderr(ctx)
I'm still learning Dagger so I'm sure there's something I'm missing. WithServiceBinding expresses that c2 depends on svc, but is there a way to express that c2 also depends on c1 having run?