0

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

如何解决这些错误?

提前致谢!

4

1 回答 1

1

我建议不要从源代码下载并将其提取到您的容器中,而是使用Microsoft 官方 Debian 存储库apt中的 Dockerfile 官方安装程序包,如下所述:

因此将其转换为 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 安装问题:

于 2018-04-02T06:20:43.897 回答