Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when talking to buildkitd through docker cli #2844

Closed
fenollp opened this issue May 3, 2022 · 2 comments
Closed

Error when talking to buildkitd through docker cli #2844

fenollp opened this issue May 3, 2022 · 2 comments

Comments

@fenollp
Copy link
Contributor

fenollp commented May 3, 2022

Using #2843, I am able to talk to buildkitd through buildctl via SSH:

BUILDKIT_HOST=ssh://toaster ./buildctl build --frontend=gateway.v0 --opt source=docker/dockerfile --opt context=https://github.com/FuzzyMonkeyCo/monkey.git --opt build-arg:PREBUILT=1 --output=type=local,dest=$PWD/
# goes through with the build

However the equivalent docker command fails:

DOCKER_HOST=ssh://toaster  DOCKER_BUILDKIT=1 docker build -o=. --platform=local --build-arg PREBUILT=1 https://github.com/FuzzyMonkeyCo/monkey.git
[+] Building 0.0s (0/0)                                                                                                                                                                       
error: no valid drivers found: Get "http://docker.example.com/v1.24/info": net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x06\x04\x00\x00\x00\x00\x00\x00\x05\x00\x00@\x00".
* Are you trying to connect to a TLS-enabled daemon without TLS?

As noted in #2839 I (uninstalled docker-ce and) only have /usr/local/bin/docker:

#!/bin/sh -eu
[[ $# -ne 3 ]] && exit 3
[[ "$1" != 'system' ]] && exit 4
[[ "$2" != 'dial-stdio' ]] && exit 5
exec $HOME/bin/buildctl --addr unix:///run/user/1000/buildkit/buildkitd.sock dial-stdio

Note: I am running latest rootless buildkitd with PATH="$PATH:$HOME/bin" ~/bin/rootlesskit --net=slirp4netns --slirp4netns-sandbox=true --slirp4netns-seccomp=true --copy-up=/etc --disable-host-loopback ~/bin/buildkitd


Is it normal that (rootless) buildkitd is not usable directly via docker CLI?

@tonistiigi
Copy link
Member

Docker and buildkitd have different APIs. You can't just point docker client to buildkit server. DOCKER_HOST != BUILDKIT_HOST.

What you want in here likely is to extend the docker buildx remote driver to also understand the ssh protocol. Currently it supports tcp and unix docker/buildx#1086 .

@fenollp
Copy link
Contributor Author

fenollp commented May 3, 2022

Thanks! not sure why I had this assumption.

@fenollp fenollp closed this as completed May 3, 2022
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

No branches or pull requests

2 participants