dockerode icon indicating copy to clipboard operation
dockerode copied to clipboard

POC: BuildKit support

Open schummar opened this issue 1 year ago • 1 comments

I managed to get BuildKit build to work! It is not perfect yet, but it works most of the time for me.

To do this, dockerode needs to create a gRPC server and serve over a hijacked session connection to the docker backend and attach the sessionId to the build request. Even a gRPC server without any implemented services will do, but it can also be used to return credentials to docker, which is needed when using private Images or Registries.

The are some open todos and problems:

  • [ ] Small changes in docker-modem are needed: https://github.com/apocas/docker-modem/pull/173
  • [x] A new release of @grpc/grpc-js is needed. The createConnectionInjector feature is already in master, but not release yet (https://github.com/grpc/grpc-node/pull/2675). At the moment one has to build @grpc/grpc-js locally (that's why it's linked locally in the package.json for now)
  • [ ] Occasionally, without changing anything, I see one of two errors in the build log. I don't know if it's a docker problem or something is wrong in my implementation. I'm happy for any hints.
    • "Error while dialing only one connection allowed"
    • "http2: frame too large"

Solves #601

schummar avatar Jun 13 '24 15:06 schummar

@apocas @grpc/grpc-js is updated now. Accepting the docker-modem PR would be in your hands. Anything unclear there?

Besides that, the random errors remain. Do you have any idea what could be wrong here? If it is a docker bug, we could still move forward here, right?

schummar avatar Jul 17 '24 10:07 schummar

@schummar Did you happen to release this anywhere?

punkpeye avatar Dec 20 '24 19:12 punkpeye

@schummar Did you happen to release this anywhere?

No, not yet. I've been experimenting with my own library — maybe something will come of it. Let's see.

schummar avatar Dec 24 '24 12:12 schummar

Looking into this, this weekend.

apocas avatar Jan 03 '25 20:01 apocas

Just needed a quick fix: https://github.com/apocas/dockerode/commit/277185b52377002f01fd868fbea340b23c95ec74#diff-b72948b87400c946b100a05748533a06bc240e7f6ba5805fb23c3d796546b788L316

Tests are passing 🎉

apocas avatar Jan 03 '25 22:01 apocas

Published https://github.com/apocas/dockerode/releases/tag/v4.0.3

apocas avatar Jan 04 '25 12:01 apocas