简体   繁体   中英

Docker container cannot clone public Github repo

I am guessing this is an internet connectivity issue, however, there might be some RSA public key missing.

I have this Dockerfile:

FROM node:4-onbuild
COPY test-install-post-publish.sh /usr/src/app/
EXPOSE 8888

The bash script that gets COPY'ed into the container looks like:

#!/usr/bin/env bash

cd # cd to home dir
mkdir suman-test
cd suman-test &&
rm -rf suman-test-projects &&
git clone git@github.com:sumanjs/suman-test-projects.git &&
cd suman-test-projects &&
./test-all.sh

I run the container, and I get this:

npm info it worked if it ends with ok
npm info using npm@2.15.11
npm info using node@v4.6.2
npm info prestart installation@1.0.0
npm info start installation@1.0.0

> installation@1.0.0 start /usr/src/app
> ./test-install-post-publish2.sh

Cloning into 'suman-test-projects'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

npm info installation@1.0.0 Failed to exec start script
npm ERR! Linux 4.4.27-boot2docker
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! installation@1.0.0 start: `./test-install-post-publish2.sh`
npm ERR! Exit status 128
npm ERR! 
npm ERR! Failed at the installation@1.0.0 start script './test-install-post-publish2.sh'.
npm ERR! This is most likely a problem with the installation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./test-install-post-publish2.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs installation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls installation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log

So it looks like the container can "connect to the internet", but it is barfing because it doesn't have the RSA information it needs. BUT this is a public repo! Why is Github asking for SSH keys and stuff?

Anyone know what might be happening? How to fix? I am certain this is a public Github repo, you could see for yourself if you want.

Perhaps I should just use HTTPS instead of SSH ?

Yes, if you didn't add the ssh key.

But still, why the above?

You need to add your public key to GitHub in order to clone through SSH -- even if it is a public repo. Why? Because git needs to authenticate though SSH to GitHub's servers in order to do the clone. And in order to do that, they need to have your public key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM