docker/docker-py

how to --build-context

fixmycode opened this issue · 1 comments

Hello, I've been looking in the documentation for a way to pass --build-context name=value to the build command, and I can't find it, is it supported? is it an anti-pattern that I should avoid? I'd normally use it to pass directories that are outside of the current directory that I require for my builds.

I don't think it's supported by the docker-py implementation. Multiple build-contexts is a feature provided by BuildKit, which uses a gRPC API. docker-py uses the legacy builder through the docker engine REST API, which cannot provide those features. This was one of the reasons for compose v2 to be rewritten in Go; if you're using the Python SDK, you could consider shelling out to the docker (or buildx) command-line similar as docker/compose#6865