Docker clone private repo - 权限被拒绝

时间:2016-06-13 15:48:45

标签: git ssh docker

我作为团队合作伙伴使用bitbucket repos。我的笔记本电脑上有多个身份,比如id_rsa和我用

生成的部署

id_rsa:

ssh-keygen

部署:

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

和配置文件

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

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

在我的bitbucket帐户中,我使用id_rsa密钥为我的帐户设置了SSH密钥,然后在我的仓库中,我使用deploy密钥设置了SSH密钥。

在命令行中,当我尝试将我的仓库克隆为git clone git@deploy:<team_account_username>/<repo_name>时,系统会要求我第一次输入密码,但之后不会输入密码。然后我尝试用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命令时,我被要求输入密码,这就是我的脚本失败的地方

0 个答案:

没有答案