C
C#13mo ago
yusuke

✅ docker build with dotnet 8

ERROR: Service 'vmg-dashboards-api' failed to build: The command '/bin/sh -c dotnet restore "vmg.dashboards/vmg.dashboards.csproj"' returned a non-zero code: 137
13 Replies
yusuke
yusukeOP13mo ago
dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app

EXPOSE 50000
EXPOSE 50001

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["vmg.dashboards/vmg.dashboards.csproj", "vmg.dashboards/"]
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj"
COPY . .
WORKDIR "/src/vmg.dashboards"
RUN dotnet build "vmg.dashboards.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "vmg.dashboards.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "vmg.dashboards.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app

EXPOSE 50000
EXPOSE 50001

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["vmg.dashboards/vmg.dashboards.csproj", "vmg.dashboards/"]
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj"
COPY . .
WORKDIR "/src/vmg.dashboards"
RUN dotnet build "vmg.dashboards.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "vmg.dashboards.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "vmg.dashboards.dll"]
compose file
version: "3.7"

services:

vmg-dashboards-api:
container_name: vmg-dashboards-api
image: vmg-dashboards-api:latest
labels:
name: "vmg-dashboards-api"
environment:
ASPNETCORE_HTTPS_PORT: "50001"
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "https://+:50001;http://+:50000"
build:
context: .
dockerfile: ./vmg.dashboards/Dockerfile
ports:
- "50000:50000"
- "50001:50001"
restart: always
networks:
- default

networks:
default:
driver: bridge
version: "3.7"

services:

vmg-dashboards-api:
container_name: vmg-dashboards-api
image: vmg-dashboards-api:latest
labels:
name: "vmg-dashboards-api"
environment:
ASPNETCORE_HTTPS_PORT: "50001"
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "https://+:50001;http://+:50000"
build:
context: .
dockerfile: ./vmg.dashboards/Dockerfile
ports:
- "50000:50000"
- "50001:50001"
restart: always
networks:
- default

networks:
default:
driver: bridge
response
Building vmg-dashboards-api
Step 1/17 : FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
---> 23570daf3230
Step 2/17 : WORKDIR /app
---> Using cache
---> bd727d53691b
Step 3/17 : EXPOSE 50000
---> Using cache
---> 47be32e4215f
Step 4/17 : EXPOSE 50001
---> Using cache
---> f19e10842eef

Step 5/17 : FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
---> be1ae8176b78
Step 6/17 : WORKDIR /src
---> Using cache
---> f80abc4b0f1c
Step 7/17 : COPY ["vmg.dashboards/vmg.dashboards.csproj", "vmg.dashboards/"]
---> Using cache
---> 313642fc0824
Step 8/17 : RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj"
---> Running in 060a6309902d
Failed to create CoreCLR, HRESULT: 0x80070008
ERROR: Service 'vmg-dashboards-api' failed to build: The command '/bin/sh -c dotnet restore "vmg.dashboards/vmg.dashboards.csproj"' returned a non-zero code: 137
Building vmg-dashboards-api
Step 1/17 : FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
---> 23570daf3230
Step 2/17 : WORKDIR /app
---> Using cache
---> bd727d53691b
Step 3/17 : EXPOSE 50000
---> Using cache
---> 47be32e4215f
Step 4/17 : EXPOSE 50001
---> Using cache
---> f19e10842eef

Step 5/17 : FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
---> be1ae8176b78
Step 6/17 : WORKDIR /src
---> Using cache
---> f80abc4b0f1c
Step 7/17 : COPY ["vmg.dashboards/vmg.dashboards.csproj", "vmg.dashboards/"]
---> Using cache
---> 313642fc0824
Step 8/17 : RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj"
---> Running in 060a6309902d
Failed to create CoreCLR, HRESULT: 0x80070008
ERROR: Service 'vmg-dashboards-api' failed to build: The command '/bin/sh -c dotnet restore "vmg.dashboards/vmg.dashboards.csproj"' returned a non-zero code: 137
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
yusuke
yusukeOP13mo ago
ah! thanks will try that
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj" --verbosity detailed
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj" --verbosity detailed
Failed to create CoreCLR, HRESULT: 0x80070008 ERROR: Service 'vmg-dashboards-api' failed to build: The command '/bin/sh -c dotnet restore "vmg.dashboards/vmg.dashboards.csproj" --verbosity detailed' returned a non-zero code: 137 not sure why it's not using the verbosity will try -v detailed same issue returning code 137.
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
yusuke
yusukeOP13mo ago
will do
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj" -v:d
RUN dotnet restore "vmg.dashboards/vmg.dashboards.csproj" -v:d
? if so it didn't work either I tried diagnostic as well since its suppose to give the most details same issue
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
yusuke
yusukeOP13mo ago
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
yusuke
yusukeOP13mo ago
these are the only packages I use
No description
yusuke
yusukeOP13mo ago
with dotnet fully releasing next week, I wonder if this is just a dotnet 8 issue with docker? i noticed visual studio doesn't add a docker file when selecting a dotnet 8 rc/preview web api project yeah I curled all of those nuget packages and I have access to all of them, no network issues on every curl I did
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
yusuke
yusukeOP13mo ago
I have just committed my changes as is to bitbucket and pulled it down onto a different pc and now it all works im so confused I do have a later version of docker on the pc where the docker-compose runs fine without any issues thanks though All I needed to do was update my docker version and it worked
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server