【发布时间】:2019-10-03 22:04:47
【问题描述】:
我刚刚开始使用 Digitalocean、Dokku 和 Docker。环顾四周后,我没有发现任何解决此特定错误的方法。
我在将 .net 核心应用程序推送到运行 Ubuntu 18.04 的 Digitalocean droplet 时遇到此错误:
remote: Step 8/13 : RUN dotnet publish -c Release -o out
remote: ---> Running in c6a4c4b610e6
remote: Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core
remote: Copyright (C) Microsoft Corporation. All rights reserved.
remote:
remote: Restore completed in 86.15 ms for /app/aspnetapp/aspnetapp.csproj.
remote: aspnetapp -> /app/aspnetapp/bin/Release/netcoreapp2.2/aspnetapp.dll
remote: aspnetapp -> /app/aspnetapp/bin/Release/netcoreapp2.2/aspnetapp.Views.dll
remote: aspnetapp -> /app/aspnetapp/out/
remote: Removing intermediate container c6a4c4b610e6
remote: ---> 40a01a03c830
remote: runtime stage name already used
To 159.89.150.200:aspnetapp
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@159.89.150.200:aspnetapp'
我已经修剪了 docker(docker system prune)并且列出的图像符合预期。
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 3b46c96be3bf 3 minutes ago 1.75GB
mcr.microsoft.com/dotnet/core/sdk 2.2 f41abe72b459 2 days ago 1.74GB
gliderlabs/herokuish latest fa3443ac31b2 2 months ago 1.21GB
gliderlabs/herokuish v0.5.0 fa3443ac31b2 2 months ago 1.21GB
root@dokku-ubuntu1804-aspnetapp-round2:~#
我销毁了目标应用程序(dokku apps:destroy aspnetapp), 重生它(dokku 应用程序:创建 aspnetapp), 并将我的本地仓库推送到服务器。这并没有解决问题。
我创建了一个新的 droplet(预装了 Dokku 和 Docker),但问题仍然存在。
这是我的 Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS runtime
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /app/aspnetapp
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
ENV ASPNETCORE_URLS http://*:5000 #
WORKDIR /app
COPY --from=build /app/aspnetapp/out ./
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
谢谢!
【问题讨论】:
标签: c# docker asp.net-core .net-core asp.net-core-mvc