profile
viewpoint

Ask questionsssh agent only forwarded from keys on Windows

Docker Engine: 18.09.2 w/ buildkit enabled Buildkit Frontend: 1.0.2-experimental Host OS: Windows 10.0.14393 Container OS: Debian 9.8 Linux Git-Bash: 2.17.1.windows.2

We're attempting to share our SSH agent socket with a building image in order to support git-ssh.

Doing an ssh-add -l we can see the key is loaded.

Our dockerfile has this directive

RUN ---mount=type=ssh \
    git clone --single-branch --branch "${GIT_BRANCH}" "${GIT_URL}" "${BUILD_HOME}"

The docker build command has this argument

--ssh default

When running the docker build, we get this error:

could not parse ssh: [default]: failed to parse C:/Users/username/AppData/Local/Temp/ssh-l0E48ifEnCIz/agent.8496: ssh: no key found

If we run the git clone locally within git-bash it works. We know that git isn't finding our private key and using it directly from the file system. The key is in a non-standard location and if ssh-agent isn't running or the key is not loaded, the clone fails.

moby/buildkit

Answer questions MiniXC

Same issue on linux, sudo DOCKER_BUILDKIT=1 docker build --ssh $SSH_AUTH_SOCK . gives me

could not parse ssh: [/tmp/ssh-kFew4Mw5SPtN/agent.2407]: invalid empty ssh agent socket, make sure SSH_AUTH_SOCK is set

while sudo DOCKER_BUILDKIT=1 docker build --ssh default . results in

could not parse ssh: [default]: invalid empty ssh agent socket, make sure SSH_AUTH_SOCK is set
useful!

Related questions

RUN --mount=type=cache causes the whole build context to be loaded in hot 2
Documentation claims that --mount works with 18.06 hot 1
rootless image didn't work on OKD (OpenShift) 3.11 hot 1
php build fails when cache is enabled hot 1
Documentation claims that --mount works with 18.06 hot 1
Cannot build from local image with buildctl (OCI Worker) hot 1
Image id shown as missing with docker history hot 1
Attempt to mount an overlay layer that is already in-use hot 1
Image id shown as missing with docker history hot 1
helper image - encountered unknown type ; children may not be fetched hot 1
Cannot build from local image with buildctl (OCI Worker) hot 1
Image id shown as missing with docker history hot 1
rootless image didn't work on OKD (OpenShift) 3.11 hot 1
Cannot build from local image with buildctl (OCI Worker) hot 1
Documentation claims that --mount works with 18.06 hot 1
Github User Rank List