Add docker cli package
Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
20
docs/drafts/1216-docker-cli-load.md
Normal file
20
docs/drafts/1216-docker-cli-load.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
slug: /1216/docker-cli-load
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Loading a dagger image into a docker daemon
|
||||
|
||||
Using `cli.#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/docker-cli-load/local.cue
|
||||
```
|
||||
|
||||
## Remote daemon, via SSH
|
||||
|
||||
```cue file=./plans/docker-cli-load/ssh.cue
|
||||
```
|
@@ -1,20 +0,0 @@
|
||||
---
|
||||
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
|
||||
```
|
23
docs/drafts/1217-docker-cli-run.md
Normal file
23
docs/drafts/1217-docker-cli-run.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
slug: /1217/docker-cli-run
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Running commands with the docker binary (CLI)
|
||||
|
||||
There's a `universe.dagger.io/docker/cli` package that allows you to run docker commands against a local or remote docker engine. Here's a few examples.
|
||||
|
||||
## Local daemon
|
||||
|
||||
```cue file=./plans/docker-cli-run/local.cue
|
||||
```
|
||||
|
||||
## Remote daemon, via SSH
|
||||
|
||||
```cue file=./plans/docker-cli-run/ssh.cue
|
||||
```
|
||||
|
||||
## Remote daemon, via HTTPS
|
||||
|
||||
```cue file=./plans/docker-cli-run/tcp.cue
|
||||
```
|
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/docker/cli"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
@@ -13,7 +14,7 @@ dagger.#Plan & {
|
||||
...
|
||||
}
|
||||
|
||||
load: docker.#Load & {
|
||||
load: cli.#Load & {
|
||||
image: build.output
|
||||
host: client.filesystem."/var/run/docker.sock".read.contents
|
||||
tag: "myimage"
|
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/docker/cli"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
@@ -16,7 +17,7 @@ dagger.#Plan & {
|
||||
...
|
||||
}
|
||||
|
||||
load: docker.#Load & {
|
||||
load: cli.#Load & {
|
||||
image: build.output
|
||||
tag: "myimage:v2"
|
||||
host: "ssh://root@93.184.216.34"
|
15
docs/drafts/plans/docker-cli-run/local.cue
Normal file
15
docs/drafts/plans/docker-cli-run/local.cue
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/docker/cli"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
|
||||
|
||||
actions: run: cli.#Run & {
|
||||
host: client.filesystem."/var/run/docker.sock".read.contents
|
||||
command: name: "info"
|
||||
}
|
||||
}
|
22
docs/drafts/plans/docker-cli-run/ssh.cue
Normal file
22
docs/drafts/plans/docker-cli-run/ssh.cue
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/docker/cli"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: filesystem: {
|
||||
"/home/user/.ssh/id_rsa": read: contents: dagger.#Secret
|
||||
"/home/user/.ssh/known_hosts": read: contents: dagger.#Secret
|
||||
}
|
||||
|
||||
actions: run: cli.#Run & {
|
||||
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
|
||||
}
|
||||
command: name: "info"
|
||||
}
|
||||
}
|
20
docs/drafts/plans/docker-cli-run/tcp.cue
Normal file
20
docs/drafts/plans/docker-cli-run/tcp.cue
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/docker/cli"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// Directory with certificates. Needs the following files:
|
||||
// - ca.pem --> (Certificate authority that signed the registry certificate)
|
||||
// - cert.pem --> (Client certificate)
|
||||
// - key.pem --> (Client private key)
|
||||
client: filesystem: "./certs": read: contents: dagger.#FS
|
||||
|
||||
actions: run: cli.#Run & {
|
||||
host: "tcp://93.184.216.34:2376"
|
||||
certs: client.filesystem."./certs".read.contents
|
||||
command: name: "info"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user