Skip to content

[WIP] Add docker engine client - #1855

Closed
helderco wants to merge 1 commit into
dagger:mainfrom
helderco:docker-client
Closed

helderco wants to merge 1 commit into
dagger:mainfrom
helderco:docker-client

Conversation

@helderco

@helderco helderco commented Mar 25, 2022 •

Copy link
Copy Markdown
Contributor

@shykes, WDYT?

I meant to put it in universe.dagger.io/docker/client but docker.#Load needs it (#1842) and it would create a circular import. Maybe move to client.#Load?

It's also flexible in the way you can compose these.

The default allows for local socket, http/https or ssh:

run: docker.#Client & {
    host: "ssh://[email protected]"
    ssh: {
        key:        client.filesystem."/home/user/.ssh/id_rsa".read.contents
        knownHosts: client.filesystem."/home/user/.ssh/known_hosts".read.contents
    }
    command: name: "info"
}

Just want to run in local daemon with another image?

_image: alpine.#Build & {
    packages: "docker-cli": {}
}
run: docker.#RunSocket & {
    input: _image.output
    host: client.filesystem."/var/run/docker.sock".read.contents
    command: {
        name: "docker"
        args: ["info"]
    }
}

This client was already discussed multiple times. We talked about it with @TomChv and @grouville on deploying to docker swarm. Also asked in #1650 (comment).

Signed-off-by: Helder Correia <[email protected]>
@netlify

netlify Bot commented Mar 25, 2022

Copy link
Copy Markdown

✅ Deploy Preview for devel-docs-dagger-io ready!

Name Link
🔨 Latest commit d181e83
🔍 Latest deploy log https://app.netlify.com/sites/devel-docs-dagger-io/deploys/623d15f5fc2c7e0009de5674
😎 Deploy Preview https://deploy-preview-1855--devel-docs-dagger-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@shykes

shykes commented Mar 25, 2022 •

Copy link
Copy Markdown
Contributor

This is a great feature, thank you :)

About the dependency issue: I think we should move it all to client or legacy including #Load. That way everything that requires a docker engine client is in the same package, I think it's cleaner that way and should remove cycles.

EDIT: mmmm I really like the subpackage name legacy as an alternative to client. It conveys the intention more clearly (see #1856) and is more accurate since technically both packages are clients - just not to the same API.

On the decision to spin out docker/client

You inspired me to share my thinkin this topic, I initially wrote it here but moved it to its own issue: #1856

@helderco helderco changed the title [WIP] Add docker client [WIP] Add docker engine client Mar 25, 2022

@TomChv TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a really nice and smooth implementation, I like it!
I left a few comments but it looks really good.

I think you should also add tests, examples and a write a piece of documentation.

#RunSSH: {
host: =~"^ssh://.+"

ssh: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation do not handle ssh key protected by password, is this something we want or not now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just haven't gotten to that. Figured it's better to add it later then delaying.

@@ -0,0 +1,74 @@
package docker

#Client: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it usable for raw ssh command on a VPS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's meant to be used with DOCKER_HOST, so the focus is on docker client commands.

@helderco

Copy link
Copy Markdown
Contributor Author

I think you should also add tests, examples and a write a piece of documentation.

Of course, it's not ready yet (WIP). It was just to discuss implementation. 😉

@helderco helderco closed this Mar 25, 2022
@helderco
helderco deleted the docker-client branch March 25, 2022 16:10
@helderco

Copy link
Copy Markdown
Contributor Author

Didn't mean to close, just renamed the branch. Shuffling PRs around.

@helderco

Copy link
Copy Markdown
Contributor Author

New PR in #1862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants