在我的Dockefile中,我将ssh键添加到docker并从bitbucket克隆项目.
我可以轻松地在Docker文件中拉出另一个分支.
ARG key
ARG pub_key
RUN mkdir /root/.ssh/
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
ADD $key /root/.ssh/
ADD $pub_key /root/.ssh/
RUN git clone git@bitbucket.org:******************/sql.git
WORKDIR "/sql"
RUN git pull origin testBranch
repo克服了sucesfully并且从testBranch成功拉出
当我使用docker run命令运行这个docker并尝试任何git命令时,它说
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
但是ssh密钥存在于目录/root/.ssh中
最佳答案
原文链接:https://www.f2er.com/docker/436111.html