Skip to main content

Loading an image into a docker engine

Dagger can build, run, push and pull docker images natively, without the need of a Docker engine. This feature is available in the package

However, sometimes after building an image, you specifically want to load it into your Docker engine. This is possible with the Docker CLI package:

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.#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@"
ssh: {
key: client.filesystem."~/.ssh/id_rsa".read.contents
knownHosts: client.filesystem."~/.ssh/known_hosts".read.contents