I have a pipeline set up which builds and pushes Docker image to my ECR. This Dockerfile runs npm install to install a few private repositories in my account for which I have set up the SSH keys to get access to those private repositories. When I run the build command on my local machine the build works perfectly but it breaks when I run the pipeline giving me the error `Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
`
RUN mkdir /root/.ssh/
RUN chmod 700 /root/.ssh
# Add the keys and set permissions
COPY ./ssh/. /root/.ssh/
RUN chmod 600 /root/.ssh/id_rsa
# Add bitbuckets key
RUN touch /root/.ssh/config && echo "Host bitbucket.org\n\tHostName bitbucket.org\n\tIdentityFile /root/.ssh/id_rsa" > /root/.ssh/config
RUN ssh-keyscan -H bitbucket.org >> /root/.ssh/known_hosts
The npm install works perfectly if I run them locally or with the Docker build command but fails when I run the pipeline. Any suggestions?
I generated new SSH keys and that fixed my problem!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.