2017-05-09 44 views
0

我正在使用圖像microsoft/windowsservercore在Windows 10桌面上創建一個在Docker for Windows上運行的Windows容器。適用於Windows的Docker:我應該在哪裏將SSH私鑰放入git的windows容器中?

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 

我可以訪問我一直在使用chocolatey這樣安裝在這個容器gitgit命令。但是,我需要運行git clone,爲此,我需要將我的SSH密鑰放在某個目錄中,以供選擇git,否則我將不得不使用https。當我使用https時,它永遠卡在cloning repository步驟。不知道爲什麼會發生。我可以從容器中ping bitbucket.orggit clone可以在主機上使用https正常工作。我需要了解的其他事情是git在哪裏尋找SSH密鑰,以便我可以創建一個並複製到該目錄?

+0

可能重複[克隆私人git回購與dockerfile](http://stackoverflow.com/questions/23391839/clone-private-git-repo-with-dockerfile) – ygesher

+0

不是真的。這個問題是針對Linux容器的,這個是針對Windows容器的。我知道如何使用Linux容器 –

回答

0

This may help

本質: 1.確定git的主目錄(在CLI 「PWD」 命令) 2.創建一個有.ssh目錄(MKDIR的.ssh) 3.打開你的密鑰文件,和出口它到.ssh目錄

相關問題