#Can you configure a dagger image in one SDK and then use that image in another?
1 messages · Page 1 of 1 (latest)
I am pretty sure this is similar to "environments" in zenith although I am interested in doing this today with what is available
Yeah, if they share the same session, you can pass the id string.
in the javascript SDK how do I get the ID string?
It's up to you. You need to save it somewhere in one SDK and open in the other. But you should only do this if they're sharing the same session, not to deserialize at a later time.
An example is doing dagger run script.sh where you call the SDKs inside.
^ this. You need to wrap your pipeline with dagger run so the session is shared across all SDK's
oh yeah I mean is there any way to literally get the ID string using the javascript library right now? like a function that returns it
Yeah, it's just await container.id().
import { connect, Client, ContainerID } from '@dagger.io/dagger'
connect(async (client: Client) => {
const cid = await client.container().from("alpine").withExec(["echo", "hello"]).id() as string
console.log(await client.container({id: cid as ContainerID}).stdout())
})
Conversion to/from string to demonstrate serialization/deserialization between different SDKs.