命令“bin/sh”返回了一个非零代码:100
The command `bin/sh` returned a non-zero code: 100
所以我尝试在 Dockerfile 中安装 OpenJDK,但我遇到了问题。它总是出错并显示以下消息:Sub-process /usr/bin/dpkg returned an error code (1)
,然后是 The command bin/sh returned a non-zero code: 100
。这是执行失败的命令。目前在 Ubuntu 20.04 VM
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY Folder/*.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet build -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/runtime:5.0
# Install OpenJDK-14
RUN apt-get update && \
apt-get install -y default-jdk && \
apt-get install -y ant && \
apt-get clean;
# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/default/
RUN export JAVA_HOME
RUN apt-get install -y supervisor # Installing supervisord
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
WORKDIR /app
COPY Folder/Lavalink/* ./
COPY --from=build-env /app/out .
#ENTRYPOINT ["dotnet", "Application.dll"]
ENTRYPOINT ["/usr/bin/supervisord"]
这也是supervisord
[supervisord]
nodaemon=true
[program:folder]
command=dotnet /app/Application.dll
[program:lavalink]
command=java -jar /app/Lavalink.jar
这是一个用5.0编写的Visual Studio项目,带有一个需要执行的.jar文件。
这些似乎没有帮助:
, Docker File Non-Zero Code 100 Error When Building 基本上我想要实现的是在容器中安装 java。最好 java 13 但这个问题阻止我这样做。最后,重要的是让您知道相同的命令适用于另一个容器。
在安装 jdk 之前添加:
RUN mkdir -p /usr/share/man/man1/
这是 debian slim images 中的一个问题,此图像基于 buster-slim。或者,您可以尝试使用基于 Ubuntu (5.0-focal) 或 Alpine (5.0-alpine) 的 dotnet/runtime 图像之一。
所以我尝试在 Dockerfile 中安装 OpenJDK,但我遇到了问题。它总是出错并显示以下消息:Sub-process /usr/bin/dpkg returned an error code (1)
,然后是 The command bin/sh returned a non-zero code: 100
。这是执行失败的命令。目前在 Ubuntu 20.04 VM
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY Folder/*.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet build -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/runtime:5.0
# Install OpenJDK-14
RUN apt-get update && \
apt-get install -y default-jdk && \
apt-get install -y ant && \
apt-get clean;
# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/default/
RUN export JAVA_HOME
RUN apt-get install -y supervisor # Installing supervisord
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
WORKDIR /app
COPY Folder/Lavalink/* ./
COPY --from=build-env /app/out .
#ENTRYPOINT ["dotnet", "Application.dll"]
ENTRYPOINT ["/usr/bin/supervisord"]
这也是supervisord
[supervisord]
nodaemon=true
[program:folder]
command=dotnet /app/Application.dll
[program:lavalink]
command=java -jar /app/Lavalink.jar
这是一个用5.0编写的Visual Studio项目,带有一个需要执行的.jar文件。
这些似乎没有帮助:
在安装 jdk 之前添加:
RUN mkdir -p /usr/share/man/man1/
这是 debian slim images 中的一个问题,此图像基于 buster-slim。或者,您可以尝试使用基于 Ubuntu (5.0-focal) 或 Alpine (5.0-alpine) 的 dotnet/runtime 图像之一。