带有Poweshell ExchangeOnlineManagement模块的Azure Docker容器



我对容器很陌生,第一次尝试Docker

我想创建一个Docker镜像,它安装了PowerShell 5.1以及PowershellGet和ExchangeOnlineManagement模块。

我真的不知道如何使用基本映像并用上面需要的模块更新它。

我建议先提取并运行映像。https://hub.docker.com/_/microsoft-powershell?tab=description

以交互方式启动容器,查看它是否满足您的需求:
docker run -it mcr.microsoft.com/powershell

如果你想创建一个自定义的Docker镜像,你需要创建一个Dockerfile

您可以将其用作基础图像,并在https://hub.docker.com/_/microsoft-powershell?tab=description:


# Indicates image that will be used as the base image.
FROM mcr.microsoft.com/powershell
...
# add your docker instructions e.g:
RUN powershell New-Item c:test
...

之后,在Dockerfile所在的同一目录中:docker build -t <username>/<image_name>:<tag_name> .

最新更新