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.
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
Related questions