Repository navigation
Closed
Description
The CLI should support loading images into the local container image store - whether that's docker, containerd through ctr/nerdctl, podman, etc.
Today, this might look something like:
$ dagger call container-echo --string-arg=foo -o ./image.tar
$ docker load -i ./image.tar
However, we should really have a native way to do this - something like:
$ dagger call container-echo --string-arg=foo --load <image>:<tag>
Why?
- Makes it easier for dagger to exist as a full replacement for docker build, as in @verdverm's use case illustrated in discord https://discord.com/channels/707636530424053791/1265384148856471622/1265384148856471622
- We want to avoid users feeling the need to wrap dagger using another cli tool as much as possible - not having an integrated way to do this common task is sad.
- The current approach is slow - even if we have a containerd content API which avoids uploading layers that weren't changed, we can't really take advantage of it (currently, not exposed in dockerd, but somewhere on the roadmap see Proposal: c8d: expose contentstore API moby/moby#44369)
So how would this work?
- The CLI should have support for a generic "loader" interface - these take a core container object, and somehow "load" them. We can implement two loaders to start:
docker load(the default)- Containerd content store streaming, implemented using the session attachables that buildkit itself has - we can allow forwarding a local containerd socket api, or opening a local content store (as the
ociexport in buildkit uses).
- The syntax could then look something like:
dagger call container-echo --string-arg=foo --load <image>:<tag>to load into the defaultdockerstoredagger call container-echo --string-arg=foo --load ./path/to/oci/layout/<image>:<tag>to export to a local oci layoutdagger call container-echo --string-arg=foo --load ./path/to/containerd/socketto load to the containerd store accessible via that API
Related:
Reacted by Jiri Daněk, Liam Jones, Steven Tobias, Valér Orlovský, Vadim Bauer, Lukas Holzer, Aron Gates, Chris Newark, Joshua Gilman, Teodor Dima and 2 more
Reacted by Helder Correia
Metadata
Metadata
Assignees
Labels
area/engineAbout dagger core engine
Activity
verdverm commentedon Jul 25, 2024
Forgot about the tagging part, for context, here is the code I use in one project
VasiliyS commentedon Nov 7, 2024
That would be a much welcomed feature!
In my case, I'd like to automate the container workflow for local dev and testing for a library I'm developing. In a nutshell, the library is a client which interacts with a server. This server is under active development and therefore a functionality is needed to automate bootstrapping dev/test/demo environment against various git refs.
Also, the users of the library will benefit from the ability to have all bootstrapping done for them for learning and development.
Currently, I'm exporting and loading a tarball, but it's slow and feels kind of wasteful.
BTW, to deal with tagging, one can simply annotate the container with
io.containerd.image.nameprior toasTarballcall.docker load -ipicks up the annotation, including the tag.nalum commentedon May 30, 2025
Just came across this, has there been any progress on adding support?
akkuman commentedon Jun 25, 2025
Considering the existence of https://github.com/psviderski/unregistry, I feel that importing images directly into the local is a necessary feature that avoids unnecessary overhead or can directly provide functionality similar to this tool