Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

docker - [email protected]: Permission denied - fatal: Could not read from remote repository, from Dockerfile

I have a Dockerfile with the following RUN instruction:

RUN pip install -r ./private_requirements.txt

The private_requirements.txt file is an ssh URL pointing to a GitLab repository:

git+ssh://[email protected]/organization/viiaa/[email protected]

When I do docker build when the RUN instruction is evaluated, I got the following output:

> [intermediate 9/9] RUN pip install git+ssh://[email protected]/organization/viiaa/[email protected]:
#13 0.574 Collecting git+ssh://****@gitlab.com/organization/viiaa/[email protected]
#13 0.574   Cloning ssh://****@gitlab.com/organization/viiaa/[email protected] (to revision v19.0) to /tmp/pip-req-build-ck2o3z6p
#13 0.574   Running command git clone -q 'ssh://****@gitlab.com/organization/viiaa/[email protected]' /tmp/pip-req-build-ck2o3z6p
#13 1.018   Warning: Permanently added the ECDSA host key for IP address '172.65.251.78' to the list of known hosts.
#13 1.286   Load key "/root/.ssh/id_rsa": invalid format
#13 1.425   [email protected]: Permission denied (publickey,keyboard-interactive).
#13 1.426   fatal: Could not read from remote repository.
#13 1.426
#13 1.426   Please make sure you have the correct access rights
#13 1.426   and the repository exists.
#13 1.428 WARNING: Discarding git+ssh://****@gitlab.com/organization/viiaa/[email protected]. Command errored out with exit status 128: git clone -q 'ssh://****@gitlab.com/organization/viiaa/[email protected]' /tmp/pip-req-build-ck2o3z6p Check the logs for full command output.
#13 1.428 ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@gitlab.com/organization/viiaa/[email protected]' /tmp/pip-req-build-ck2o3z6p Check the logs for full command output.
------
executor failed running [/bin/sh -c pip install git+ssh://[email protected]/organization/viiaa/[email protected]]: exit code: 1

I already added my public key to gitlab profile keys

question from:https://stackoverflow.com/questions/65919776/gitgitlab-com-permission-denied-fatal-could-not-read-from-remote-repository

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check your error

#13 1.286   Load key "/root/.ssh/id_rsa": invalid format

Go there and check your private key. It should have the form

-----BEGIN OPENSSH PRIVATE KEY-----
......
......
......
......
......
......
......=
-----END OPENSSH PRIVATE KEY-----

It can be that you have copied in id_rsa the content of the public key and not the private key itself.

Public key must be saved in the same folder /root/.ssh/id_rsa.pub . It must be a different file with the name id_rsa.pub


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...