I'm trying to npm install a project with git+ssh://git@github.com
dependencies using node:10.21.0-jessie-slim docker image.
I'm running a ssh-keyscan like that:
RUN mkdir /root/.ssh \
&& ssh-keyscan github.com >> /root/.ssh/known_hosts
Without the package-lock, I'm able to install the dependencies. But when the package-lock exists, the authenticity of host 'github.com (140.82.114.3)' can't be established.
I found that when I run with package-lock, the know_hosts file used is the one in /home/node/.ssh/
So, I add it on my Dockerfile:
ssh-keyscan github.com >> /home/node/.ssh/known_hosts
And it works. But I want to know why it happens.