Debian Docker 容器中的 PowerShell Core 错误

标签 powershell docker debian dockerfile powershell-core

我是 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

如何解决这些错误?

提前致谢!

最佳答案

我建议您使用 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 镜像之一开始,但是当然,您需要自己解决树莓派安装问题:

关于Debian Docker 容器中的 PowerShell Core 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49599096/

相关文章:

Powershell函数返回实例化的对象......有点?

excel - Powershell Excel 自动添加工作表

docker - 如何在IBM Bluemix中强制Docker容器连接卷?

docker - 使用 Deployment 在 kubernetes 中模拟守护进程集

debian - 如何恢复 ufw 命令?

linux - 每次重新启动 VPS 时,Dnsmasq 都无法启动

json - Powershell 脚本缺少类型名称

windows - 在与 ssh + Bash 一起使用并在本地与 Git 一起使用的 Windows Powershell 中设置 TERM 环境变量?

docker - 如何将参数附加到容器命令?

c++ - 如何为在 x86 主机上为arm目标交叉编译的项目安装依赖项