是否可以在Linux dotnet容器中运行PowerShell Core?

时间:2018-06-05 15:31:20

标签: docker .net-core powershell-core

我可以看到microsoft/dotnet中没有Powershell:

C:\> docker run -it microsoft/dotnet:2.1-sdk bash
root@5397dac12c1e:/# pwsh
bash: pwsh: command not found

当我尝试以下列方式添加它时,受到PowerShell dockerfiles的启发:

FROM microsoft/dotnet:2.1-sdk
RUN apt-get update     && apt-get install -y --no-install-recommends         apt-utils         ca-certificates         curl         apt-transport-https         locales    && rm -rf /var/lib/apt/lists/*
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/microsoft.list
RUN apt-get update     && apt-get install -y --no-install-recommends     powershell

...步骤RUN [...] apt-get install [...] powershell失败,

Fetched 10.3 MB in 11s (914 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 powershell : Depends: libssl1.0.0 but it is not installable
              Depends: libicu55 but it is not installable
E: Unable to correct problems, you have held broken packages.

我想在Debian Stretch容器中尝试使用Ubuntu方法太冒犯了。我想知道是否有更简单的方法来获取同时存在dotnet-sdkpwsh的容器。

1 个答案:

答案 0 :(得分:0)

似乎最简单的解决方案就是等待新版本的PowerShell Core that's going to support Ubuntu 18.04 - 然后将其与dotnet:2.1-sdk-bionic匹配。