2

I am using the image microsoft/windowsservercore to create a windows container running on Docker for windows on Windows 10 Desktop. I have installed git in this container using chocolatey like this:

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 is installed fine in the container and if I open the CMD prompt of the container like this:

docker exec -it mycontainer cmd

I can access the git command. However, I need to run git clone and for that I either need to place my SSH keys in some directory to be picked by git or I will have to use https. When I use https, it gets stuck at cloning repository step forever. Not sure why that happens. I can ping bitbucket.org from the container and git clone works fine on the host machine using https. Other thing I need to understand is where does git look for SSH key so that I can create one and copy to that directory ?

veben
  • 19,637
  • 14
  • 60
  • 80
Mandeep Singh
  • 7,674
  • 19
  • 62
  • 104
  • Possible duplicate of [Clone private git repo with dockerfile](http://stackoverflow.com/questions/23391839/clone-private-git-repo-with-dockerfile) – ygesher May 09 '17 at 08:31
  • Not really. That question is for Linux container and this one is for a windows container. I know how to work with Linux containers – Mandeep Singh May 09 '17 at 09:09

1 Answers1

1

This may help

Essentially: 1. Identify git home directory ("pwd" command in CLI) 2. Create a .ssh directory there (mkdir .ssh) 3. Open your key file, and export it to that .ssh directory