admin管理员组文章数量:1332377
I am getting an odd error when trying to build my dockerfile. It appears docker is not recognizing this as a valid command but I am not sure why.
Here is the start of my dockerfile where the error is occurring.
# Use the official .NET SDK image to build the app
FROM mcr.microsoft/dotnet/sdk:8.0 AS build
WORKDIR /src
ENV ASPNETCORE_ENVIRONMENT=Development
ENV CONNECTION_STRING=""
ENV JWT_KEY=""
# Copy the files
COPY . .
# Publish each project in the solution
RUN dotnet publish APIGateway -c Release -o /app/publish/APIGateway
# Use the official .NET runtime image to run the app
FROM mcr.microsoft/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
The 'RUN' command appears to be where the error is occurring. I have tried to rewrite the line thinking maybe some hidden invalid character got in there but that is not helping. 'dotnet' should be installed as I am starting from the dotnet sdk base image.
I am getting an odd error when trying to build my dockerfile. It appears docker is not recognizing this as a valid command but I am not sure why.
Here is the start of my dockerfile where the error is occurring.
# Use the official .NET SDK image to build the app
FROM mcr.microsoft/dotnet/sdk:8.0 AS build
WORKDIR /src
ENV ASPNETCORE_ENVIRONMENT=Development
ENV CONNECTION_STRING=""
ENV JWT_KEY=""
# Copy the files
COPY . .
# Publish each project in the solution
RUN dotnet publish APIGateway -c Release -o /app/publish/APIGateway
# Use the official .NET runtime image to run the app
FROM mcr.microsoft/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
The 'RUN' command appears to be where the error is occurring. I have tried to rewrite the line thinking maybe some hidden invalid character got in there but that is not helping. 'dotnet' should be installed as I am starting from the dotnet sdk base image.
Share Improve this question asked Nov 22, 2024 at 5:20 JAKDevJAKDev 132 bronze badges 2 |1 Answer
Reset to default 0I found my issue. I had multiple docker files but each for a different application. I was missing the 'RUN' command from that line on just that file. It was so obvious I missed it. Thank you all for your suggestions!
本文标签: cfailed to solve dockerfile parse error on line 13 unknown instruction dotnetStack Overflow
版权声明:本文标题:c# - failed to solve: dockerfile parse error on line 13: unknown instruction: dotnet - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742295562a2448652.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
FROM mcr.microsoft/dotnet/sdk:8.0 AS build
(newline)RUN dotnet --version
(newline)ENTRYPOINT ["dotnet", "--version"]
and see if this works by itself. This works fine by itself for me: i.sstatic/pBusSDsf.png - dotnet works both as a step in the build viaRUN
and as the entrypoint for the image. – ProgrammingLlama Commented Nov 22, 2024 at 5:28RUN
– Flurin Commented Nov 22, 2024 at 6:36