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

rootless: containerd worker: Add fallback when buildkitd cannot access to conainerd #2968

Merged
merged 1 commit into from Jul 19, 2022

Conversation

ktock
Copy link
Collaborator

@ktock ktock commented Jul 19, 2022

As discussed in #2965, the current rootless containerd worker doesn't allow fallbacks when it can't access to the containerd socket (e.g. by permission denied). But we should perform a fallback to keep the backward compatibility with the previous version of buildkitd.

This commit fixes this issue by adding a fallback logic for the case when buildkitd failed to access to the containerd socket.

main

$ rootlesskit buildkitd --addr=unix:///tmp/buildkit/buildkitd.sock
INFO[2022-07-19T01:49:45Z] auto snapshotter: using overlayfs            
INFO[2022-07-19T01:49:45Z] found worker "8envtv9nxu2808m374pct8b4z", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:2f891249d0b4 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/386] 
buildkitd: failed to dial "/run/containerd/containerd.sock": connection error: desc = "transport: error while dialing: dial unix /run/containerd/containerd.sock: connect: permission denied"
failed to connect client to "/run/containerd/containerd.sock" . make sure containerd is running
github.com/moby/buildkit/worker/containerd.NewWorkerOpt
	/go/src/github.com/moby/buildkit/worker/containerd/containerd.go:33
main.containerdWorkerInitializer
	/go/src/github.com/moby/buildkit/cmd/buildkitd/main_containerd_worker.go:262
main.newWorkerController
	/go/src/github.com/moby/buildkit/cmd/buildkitd/main.go:690
main.newController
	/go/src/github.com/moby/buildkit/cmd/buildkitd/main.go:633
main.main.func3
	/go/src/github.com/moby/buildkit/cmd/buildkitd/main.go:263
github.com/urfave/cli.HandleAction
	/go/src/github.com/moby/buildkit/vendor/github.com/urfave/cli/app.go:526
github.com/urfave/cli.(*App).Run
	/go/src/github.com/moby/buildkit/vendor/github.com/urfave/cli/app.go:288
main.main
	/go/src/github.com/moby/buildkit/cmd/buildkitd/main.go:313
runtime.main
	/usr/local/go/src/runtime/proc.go:255
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1581
[rootlesskit:child ] error: command [buildkitd --addr=unix:///tmp/buildkit/buildkitd.sock] exited: exit status 1
[rootlesskit:parent] error: child exited: exit status 1

PR

$ rootlesskit buildkitd --addr=unix:///tmp/buildkit/buildkitd.sock
INFO[2022-07-19T01:49:15Z] auto snapshotter: using overlayfs            
INFO[2022-07-19T01:49:16Z] found worker "8envtv9nxu2808m374pct8b4z", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:2f891249d0b4 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/386] 
WARN[2022-07-19T01:49:16Z] skipping containerd worker, as failed to connect client to "/run/containerd/containerd.sock": failed to dial "/run/containerd/containerd.sock": connection error: desc = "transport: error while dialing: dial unix /run/containerd/containerd.sock: connect: permission denied" 
INFO[2022-07-19T01:49:16Z] found 1 workers, default="8envtv9nxu2808m374pct8b4z" 
WARN[2022-07-19T01:49:16Z] currently, only the default worker can be used. 
INFO[2022-07-19T01:49:16Z] running server on /tmp/buildkit/buildkitd.sock 

…inerd

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@tonistiigi
Copy link
Member

closes #2965?

@ktock
Copy link
Collaborator Author

ktock commented Jul 23, 2022

Yes.

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

Successfully merging this pull request may close these issues.

None yet

3 participants