【问题标题】:PowerShell Core in Debian Docker Container ErrorDebian Docker 容器中的 PowerShell Core 错误
【发布时间】:2018-04-01 14:31:39
【问题描述】:

我是 Docker 新手,正在尝试创建一个安装了 Raspbian 基础和 PowerShell Core 的 Docker 映像。

编辑: 更新 Dockerfile 以包含 libicu52 包,这解决了主要错误:缺少 libpsl-native 或依赖项不可用。更改了CMD 参数,现在出现了不同的错误。

这是我的 Dockerfile:

# Download the latest RPi3 Debian image
FROM resin/raspberrypi3-debian:latest

# Update the image and install prerequisites
RUN apt-get update && apt-get  install -y \
    wget \
    libicu52 \
    libunwind8 \
    && apt-get clean

# Grab the latest tar.gz
RUN wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0-rc.2-linux-arm32.tar.gz

# Make folder to put PowerShell
RUN mkdir ~/powershell

# Unpack the tar.gz file
RUN tar -xvf ./powershell-6.0.0-rc.2-linux-arm32.tar.gz -C ~/powershell

# Run PowerShell
CMD pwsh -v

新错误:

hostname: you must be root to change the host name
/bin/sh: 1: pwsh: not found

如何解决这些错误?

提前致谢!

【问题讨论】:

    标签: powershell docker debian dockerfile powershell-core


    【解决方案1】:

    我建议不要从源代码下载并将其提取到您的容器中,我建议您使用来自Microsoft's official Debian repository 的 Dockerfile 的官方 apt 安装程序包,如下所述:

    因此将其转换为 Dockerfile 格式:

    # Install powershell related system components
    RUN apt-get install -y \
        gnupg curl apt-transport-https \
        && apt-get clean
    
    # Import the public repository GPG keys
    RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    
    # Register the Microsoft's Debian repository
    RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
    
    # Install PowerShell
    RUN apt-get update \
        && apt-get install -y \
        powershell
    
    # Start PowerShell
    CMD pwsh
    

    或者,您也可以尝试从原始 Microsoft docker Linux 映像之一开始,但当然您需要自己解决 raspberry 安装:

    【讨论】:

    • 我尝试使用建议的方法,但我确实将其更改为 debian-8,因为基础映像仍然是 Jessie。但是使用微软提供的代码却找不到powershell包。
    • 更重要的是,Microsoft 存储库中的所有文件都用于 x64 架构,而不是 armhf,这会阻止它们中的任何一个被用作 rpi 映像的一部分。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-25
    • 2018-11-17
    • 2020-01-04
    • 1970-01-01
    • 2020-10-16
    • 2018-07-15
    相关资源
    最近更新 更多