Loading an image into a docker engine
This documentation is for an older version of Dagger, which is no longer actively maintained.
We encourage you to upgrade and refer to the documentation for the most current version.
If you cannot upgrade to the latest version, please contact us in the help forum on Discord. When contacting us, please let us know why you cannot move to the latest version. From there, our team will work with you on your use case.
Dagger can build, run, push and pull docker images natively, without the need of a Docker engine.
This feature is available in the package universe.dagger.io/docker
.
However, sometimes after building an image, you specifically want to load it into your Docker engine.
This is possible with the Docker CLI package: universe.dagger.io/docker/cli
.
Using cli.#Load
, you can load an image built by Dagger into a local or remote engine.
It can be useful to debug or test a build locally before pushing.
Local daemon
Remote daemon, via SSH
package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
"universe.dagger.io/docker/cli"
)
dagger.#Plan & {
client: filesystem: {
"~/.ssh/id_rsa": read: contents: dagger.#Secret
"~/.ssh/known_hosts": read: contents: dagger.#Secret
}
actions: {
build: docker.#Build & {
...
}
load: cli.#Load & {
image: build.output
tag: "myimage:v2"
host: "ssh://root@93.184.216.34"
ssh: {
key: client.filesystem."~/.ssh/id_rsa".read.contents
knownHosts: client.filesystem."~/.ssh/known_hosts".read.contents
}
}
}
}