我可以看到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-sdk
和pwsh
的容器。
似乎最简单的解决方案就是等待支持Ubuntu 18.04的PowerShell Core的新版本 - 然后将其与dotnet:2.1-sdk-bionic
匹配。