#is it possible to start a container and keep it running across invocations ?

1 messages · Page 1 of 1 (latest)

woven mica
#

Hi Folks

I am trying to see if i can keep a container running across multiple invocations. This is meant to increase development cycle when running an e2e tests that requires dependent services to be only started once. the tests can run many times across subsequent calls. So basically this is caching an executable and not a file system per say.

Regards

somber ridge
#

This should be possible using services, you can learn more about that here in this doc: https://docs.dagger.io/757394/use-services/#introduction

I would also suggest exploring the (still early release) dagger up function that is coming with our upcoming release of dagger modules. This allows you start up services and forward ports similar to what you might do with Docker and Docker Compose.

https://docs.dagger.io/zenith/reference/979596/cli/#dagger-up

The Dagger CLI provides a command-line interface to Dagger.

Dagger v0.9.0 includes a breaking change for binding service containers. The Container.withServiceBinding API now takes a Service instead of a Container, so you must call Container.asService on its argument. See the section on binding service containers for examples.

woven mica
# somber ridge This should be possible using services, you can learn more about that here in th...

i am sorry if i made myself not clear. I am building a tool in go that starts those services using the go sdk. So i am already using services but they all go away when the executable finishes

Now its good to see that dagger has an up cli which i did not know existed so far. So my question is this something that is exposed via the sdk ? Meaning as the cache api is exposed so is the up command going to be exposed via an sdk api ?

#

tbc the reason why they are being stooped is because my executable does not stop running if i dont call the service.close so the question becomes show i make sure the executable running in fg is foked and not wait for the services to be terminated

oak temple
#

What SDK are you writing your pipeline on?

woven mica
# oak temple What SDK are you writing your pipeline on?

i am using the go sdk. I am trying to use dagger as a library for now to run multiple tests across multiple invocations

thank you for filing pointing to that issue. I am thinking that gradle would also be something that starts and stays resident in memory. Now that i think about it i would call the API something like StartAndStayResident ! thats a flashback from my dos days .. yeah i am that old !