bbrun
bbrun copied to clipboard
SSH Keys
It would be beneficial to add a flag for ssh keys, because a pipeline could be installing a private package.
Is there any plan / workaroud for this ?
I added the following volume to line 53 of the docker.js file:
-v ~/.ssh:/root/.ssh:ro
: `run --rm -P -v ${pwd()}:${workDir} -v ~/.ssh:/root/.ssh:ro -w ${workDir} ${image} bash ${BUILD_SCRIPT}`;
Thus your local SSH-keys are mapped into the docker container.
do you know if such config would work on a windows machine? thanks
do you know if such config would work on a windows machine? thanks
Unfortunately I have no experience on windows machines. It might just be necessary to swap the placeholder for the user-folder (https://stackoverflow.com/questions/20226147/where-does-github-for-windows-keep-its-ssh-key)?
@bestit-ewieser thanks mate! :) If windows filesystem, all you need to is
-v C:\\Users\\[username]\\.ssh:/root/.ssh:ro
However, I got another error after trying to use the ssh keys:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Therefore, I ended in creating a docker image, based on the following docker file, within a folder, with my windows generated ssh key:
FROM node:10.15.3
RUN mkdir /root/.ssh/
COPY ./id_rsa.pub /root/.ssh/id_rsa.pub
COPY ./id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
docker build . -t node:10.15.3-custom
And then, update the bitbucket pipeline so it uses my new docker image
image: node:10.15.3:custom