【发布时间】:2019-10-29 22:18:18
【问题描述】:
我正在尝试使用以下 Dockerfile 为我的 API 构建 Docker 映像:
FROM microsoft/dotnet AS build-env
ARG source
RUN echo "source: $source"
WORKDIR /app
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install nodejs
RUN node -v
RUN npm -v
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
#Copy everything else & build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/dotnet
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 80
ENTRYPOINT ["dotnet", "API_App.dll"]
但是,当我运行 docker build 命令时,我不断收到以下错误:
Unable to locate package nodejs
The command '/bin/sh -c apt-get install nodejs returned a non-zero code: 100
谁能告诉我为什么会出现这个错误?
节点版本:8.11.3
npm 版本:5.6.0
【问题讨论】:
-
成功了!谢谢!
标签: docker dockerfile