Docker克隆私人回购 – 权限被拒绝

作为团队成员,我使用bitbucket回购。 我的笔记本电脑上有多个标识,比如说id_rsa,然后部署我生成的

id_rsa:

ssh-keygen 

部署:

 ssh-keygen -f ~/.ssh/deploy -C "deploy" 

和一个configuration文件

 Host bitbucket.org HostName bitbucket.org IdentityFile ~/.ssh/id_rsa Host deploy HostName bitbucket.org IdentityFile ~/.ssh/deploy 

在我的bitbucket帐户中,我使用id_rsa密钥为我的帐户设置了一个SSH密钥,然后在我的回购站中使用deploy密钥设置了一个SSH密钥。

在命令行中,当我试图将我的repo克隆为git clone git@deploy:<team_account_username>/<repo_name> ,我被要求在第一次input密码,但不是在那之后。 然后我试图用Docker克隆我的回购:

 # Use anaconda docker image from ContinuumIO FROM continuumio/anaconda # Make ssh dir RUN mkdir /root/.ssh/ # Copy over private key, and set permissions ADD deploy /root/.ssh/deploy ADD config /root/.ssh/config RUN chmod 600 /root/.ssh/* # Create known_hosts RUN touch /root/.ssh/known_hosts # Add bitbuckets key RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts # Clone git repos RUN git clone git@deploy:<team_account_username>/<repo_name> # Set default directory to execute CMD WORKDIR /<repo_name> # Run EART CMD python app.py 

当脚本试图克隆回购,我得到了

 Permission denied (publickey) fatal: The remote end hung up unexpecedly 

[编辑]

我试图直接在容器中运行这些命令,正如在我的评论中所说的,当我运行clone命令时,我被要求input密码,这就是我的脚本失败的地方