Windows Server 2016 TP4上的Docker通过Powershell在容器中下载git [英] Docker on Windows Server 2016 TP4 Downloading git in container through powershell
问题描述
我有一个角度用户界面和一个nodejs api.我目前正在Azure中运行Windows Server 2016 TP4,这是我要通过的步骤:
I have an angular UI and a nodejs api. I am currently running windows server 2016 TP4 in Azure.Here are the steps I go through:
- 我能够远程访问,创建图像,基于这些图像创建容器,并可以将它们附加到这些容器上.
- 我从docker提取了一个nodejs映像:
docker pull microsoft/node
,然后从该映像创建了一个容器:docker run --name'my_api_name'-it microsoft/node cmd
-
该命令通过Windows命令提示符将我带入容器.我输入
powershell
,它将带我进入powershell外壳,并且我可以运行npm命令.
- I am able to remote in, create images, create containers based off those images, and attach to those containers no problem.
- I pulled a nodejs image from docker:
docker pull microsoft/node
and then created a container from that image:docker run --name 'my_api_name' -it microsoft/node cmd
That command takes me into the container via a windows command prompt. I type
powershell
which takes me into a powershell shell and i can run npm commands.
我的问题是,如何将git安装到该容器上??我想访问包含我的应用程序的存储库,将其拉下并在此容器中运行.我最终将这个容器映像推送到docker注册表,以便客户端可以将其下拉并在Windows env上运行.
My question is, how do I install git onto this container? I want to reach out to the repository holding my app, pull it down and run it in this container. I will eventually push this container image up to the docker registry so clients can pull it down and run it on their windows env.
推荐答案
您可以在admin shell中这样做:
You can do it like this in admin shell:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
cinst -y git
这篇关于Windows Server 2016 TP4上的Docker通过Powershell在容器中下载git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!