为什么下面的OSX中的Dockerfile卡在dotnet restore
上并且没有进入dotnet run
?
(当我手动执行命令时它起作用)
Step 8 : RUN dotnet restore
---> Running in 3ef8b4c1d107
Dockerfile:
FROM microsoft/dotnet
VOLUME /Documents/Docker/dnc
EXPOSE 80
ENV "ASPNETCORE_URLS=http://+:80"
RUN mkdir app
RUN cd app
RUN dotnet new -t web
RUN dotnet restore
RUN dotnet run
答案 0 :(得分:0)
在another SO post的帮助下,我发现我错过了WORKDIR
正确的代码是:
FROM microsoft/dotnet
VOLUME /Documents/Docker/dnc
EXPOSE 80
ENV "ASPNETCORE_URLS=http://+:80"
RUN mkdir app
# RUN cd app <- turned out was not necessary.
WORKDIR /app
RUN dotnet new -t web
RUN dotnet restore
RUN dotnet run