#Zenith: Exporting container to OCI tarball doesn't write file

1 messages · Page 1 of 1 (latest)

novel pulsar
#

I tried building some application and for local testing, I thought that it would be nice to just load a tarball containing the image into docker.
Well, it doesn't write the tar file but the call itself seems to result in success.
Here's a function to replicate:

func (m *Ci) ExportTarImage(ctx context.Context) (bool, error) {
    return dag.Container().From("alpine").Export(ctx, "/tmp/alpine.tar")
}

And here is the CLI result:

swoidig@SHIMANO-LENOVO ~/p/p/dagger-ci> dagger call exportTarImage
✔ dagger call export-tar-image [2.93s]
┃ true                                                                                                                                                                                    
• Engine: a42af3954cb4 (version v0.9.3)
⧗ 5.02s ✔ 34 ∅ 8

swoidig@SHIMANO-LENOVO ~/p/p/dagger-ci> ls /tmp | grep alpine.tar
# ... nothing here dude

Can someone help me with this?

outer hare
#

For security, modules can't directly access the host to export - that export is actually exporting into the module's running container.
To return the tarball directly you'll need to return a *File from ExportTarImage, which you can then get from the CLI by running dagger export instead of dagger call.

#

Or you could just return the Container type directly, and then dagger export will export the image as an OCI tarball anyways so you don't need to write the translation code for that yourself if you don't want to.

#

Agreed that there's some weirdness with how this worked pre-modules - I originally wrote up some thoughts on https://github.com/dagger/dagger/issues/5867, it's a bit of a papercut IMO, but not quite sure what a nice solution for this is.

GitHub

Application Delivery as Code that Runs Anywhere. Contribute to dagger/dagger development by creating an account on GitHub.