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