#reusing a container using its ID

1 messages · Page 1 of 1 (latest)

reef patrol
#

I am trying out dagger for a use case where I have a dumb CLI on top of dagger, and is responsible for calling dagger call ....

is it possible somehow to have a function return a container-id, and then a second function that takes that container-id as input and do something.

can we use Env api for this?

reef patrol
#

Thanks Marcos. hmm, I don't use dagger shell here. do you know what is differnt about shell that we can use it there, but not through dagger calls?

trail gyro
reef patrol
#

Hmm but is it possible to do just using pure dagger call commands? Eg i noticed something like env api where we have input and output, which seemed like a similar concept

#

But when i do that, the second request fails to find the mount i did in first call, and it seems like it tries to execute everythijg from start again

trail gyro
#

one thing that we could Do in the CLI is to allow passing ContainerID's as dagger.Container directrly as it seems that we're only allowing to pass image references via dagger call

#

it should be a relatively straightforward change if you want to give it a shot 🙏

#

Or.. I can try to use this thread and give our Dagger agent a try to fix this issue by using container-use cc @chilly notch

reef patrol
#

dag.LoadContainerFromID function and pass the containerID as a string for the moment

I tried using this, but for some reason that did not work, that is when i ran into Env API (which also didn't work for me for some reason). I will try again with fresh eyes tomorrow.

reef patrol
#

Oh, hmmm. Could you share how you did it?

trail gyro
unique glacier
#

@trail gyro @reef patrol IDs are not guaranteed to work across dagger sessions. Dagger shell is immune to this problem because you can compose function calls in the same session. But each dagger call is a different session.

#

So if you want to pass IDs around from the CLI, dagger shell is a must

trail gyro
unique glacier
trail gyro
#

@reef patrol sessions aside, I'm curious about what the use-case is that you need to run multiple dagger calls and pass containers over

reef patrol
#

I am trying a plugin that helps with local dev experience. So a user can run build/up/export commands

With expectation that the user may be able to run build and up as two separate trigger of my plugin and i should be able to use the artifacts i build during up without having to rebuild. And also be able to do combo of these using flags.

Beside that i would really like my own “logging” instead of dagger tracing (which is great, but too verbose for this case). I just want to output “starting build”, “completed build, took x seconds”, starting service at <url> and here are the endpoints

#

I want to have dagger tracing behind a —debug flag