#reusing a container using its ID
1 messages · Page 1 of 1 (latest)
If you use the shell you can easily do this
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?
Shell is more convenient when you need to combine multiple function calls without writing any extra code.
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
@reef patrol the workaround for this is to use the dag.LoadContainerFromID function and pass the containerID as a string for the moment
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
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.
that worked for me 🤔
Oh, hmmm. Could you share how you did it?
Sure, will do in a bit
@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
ok, I see. I had a misunderstanding that loadXFromID was supposed to work across sessions. Seems like it did for my very basic use-case but I see why they might not work for all cases
I think IDs are slowly getting more and more stable. So it's possible that some IDs, sometimes, will work across sessions. But it's not 100% yet, so better to assume 0% 🙂
@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
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