SSH option missing from the python client
agyoungs opened this issue · comments
Maybe I missed it, but it appears that the --ssh
option is missing from the python client. This option provides the SSH agent socket or keys from the host to the build. (e.g. docker build --ssh=default ...
)
Am I missing something obvious here or is this option not provided?
docker-py is a wrapper for docker engine API & it seems the ssh option is not available. https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageBuild
as workaround, u can use build arg & pass ssh to it.
@naufalafif Thanks for the reply and I've since realized that the --ssh
feature was unfortunately not available with the Docker Engine API.
How would I use build args as a workaround? As I understand I would use ARG SSH
in the Dockerfile, but I'm not sure how I would be able to use the agent in the docker build environment to clone a repo or something similar.
You're correct - this is not possible using the API via the Python bindings, which only support the classic builder and not BuildKit.
For now, the best option (although not ideal) is to shell out to docker buildx
.