I copying over my ssh key in a dockerfile for dev purposes on a windows machine, but I cannot get the SSH_AUTH_SOCK variable set,
here is my Dockerfile
FROM node:alpine
WORKDIR /usr/src/app
COPY package.json .
ADD id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa \
&& touch /root/.ssh/known_hosts \
&& ssh-keyscan -H github.com >> /root/.ssh/known_hosts \
&& eval `ssh-agent -s` && ssh-add /root/.ssh/id_rsa
RUN yarn
CMD [ "npm", "start" ]
I tried to eval the result of ssh-agent as well in my compose file
command: >
sh -c 'eval `ssh-agent -s`
&& ssh-add /root/.ssh/id_rsa
&& echo $SSH_AUTH_SOCK'
And when I executed my simple nodejs file, the SSH_AUTH_SOCK
is not set.
printenv
doesn't show it as well, is there a way to do this.
I can see there are lots of ssh-agent forwarder solution for linux and osx, but it does not work on windows.
DOCKER_BUILDKIT=1 docker build --ssh default .
returnscould not parse ssh: [default]: failed to parse C:/Users/user/AppData/Local/Temp/ssh-IbLoxaMx5H4R/agent.19660: ssh: no key found
– Barman