Skip to content

[Request]: RUN commands in container build that require ssh agent access. #1472

@jglogan

Description

@jglogan

Feature or enhancement request details

As a container user, I can do a build with the following command and Dockerfile, where cloning the git repo requires ssh authentication, and I have an ssh-agent running on my host at SSH_AUTH_SOCK.

The full syntax of the docker build option is --ssh=default|<id>[=<socket>|<key>[,<key>]]. The scope of this enhancement is just:

  • Enable ssh forwarding when initially configuring the build container.
  • When --ssh default is provided with container build, relay the ssh configuration via the container-builder-shim API, and register an ssh attachment for the buildkit session.

The options to pass other sockets or keys into buildkit are not in the scope of this enhancement.

container build -t test -f Dockerfile --ssh default .
FROM alpine
RUN apk add openssh-client git
RUN --mount=type=ssh git clone git@somehost.example.com:max-mustermann/yolo.git

refs:

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    builderIssues and features associated with container image buildingnextMust-have items for current and next milestone

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions