2

我正在使用该映像microsoft/windowsservercore创建一个在 Docker 上运行的 Windows 容器,用于 Windows 10 桌面上的 Windows。我已经安装git在这个容器中,使用chocolatey如下:

FROM microsoft/windowsservercore

# some other steps go here

RUN @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

RUN choco install git -params '"/GitAndUnixToolsOnPath"' -y

EXPOSE 8080  

# some other steps go here

Git 在容器中安装得很好,如果我CMD像这样打开容器的提示:

docker exec -it mycontainer cmd

我可以访问git命令。但是,我需要运行git clone,为此我需要将我的 SSH 密钥放在某个目录中以供选择,git或者我将不得不使用https. 当我使用https时,它会cloning repository永远卡在 step 上。不知道为什么会这样。我可以bitbucket.org从容器 ping 并git clone使用https. 我需要了解的另一件事是在哪里git寻找 SSH 密钥以便我可以创建一个并复制到该目录?

4

1 回答 1

1

这可能会有所帮助

本质上: 1. 识别 git 主目录(CLI 中的“pwd”命令) 2. 在此处创建一个 .ssh 目录(mkdir .ssh) 3. 打开您的密钥文件,并将其导出到该 .ssh 目录

于 2017-05-09T18:57:35.957 回答