Merge pull request #1842 from helderco/docker-load

Add export and load for dagger images
This commit is contained in:
Andrea Luzzardi
2022-03-25 12:22:40 -07:00
committed by GitHub
15 changed files with 488 additions and 7 deletions

View File

@@ -0,0 +1,20 @@
---
slug: /1216/engine-load
displayed_sidebar: europa
---
# Loading a dagger image into a docker daemon
Using `docker.#Load`, you can save a dagger image (`docker.#Image`) into a local or remote engine.
It can be useful to debug or test a build locally before pushing.
## Local daemon
```cue file=./plans/local.cue
```
## Remote daemon, via SSH
```cue file=./plans/ssh.cue
```

View File

@@ -0,0 +1,22 @@
package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
actions: {
build: docker.#Build & {
...
}
load: docker.#Load & {
image: build.output
host: client.filesystem."/var/run/docker.sock".read.contents
tag: "myimage"
}
}
}

29
docs/drafts/plans/ssh.cue Normal file
View File

@@ -0,0 +1,29 @@
package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: filesystem: {
"/home/user/.ssh/id_rsa": read: contents: dagger.#Secret
"/home/user/.ssh/known_hosts": read: contents: dagger.#Secret
}
actions: {
build: docker.#Build & {
...
}
load: docker.#Load & {
image: build.output
tag: "myimage:v2"
host: "ssh://root@93.184.216.34"
ssh: {
key: client.filesystem."/home/user/.ssh/id_rsa".read.contents
knownHosts: client.filesystem."/home/user/.ssh/known_hosts".read.contents
}
}
}
}