简体   繁体   中英

ASP.NET Core 2.0 docker container crashes on Linux with exit code 132 (SIGILL)

I have a ASP.NET Core 2.0 Docker image targeted for Linux. This runs fine on my windows development machine. When I run this iamge as a docker container on Linux, it crashes the moment a request is made to the running container. No log entries are added, and no exception is generated. Using Docker CLI I can see the container stopped with exit code 132, which seems to be 'SIGILL', 'illegal instruction'.

In the test file below, the error occurs when adding

asp-for="LoginCode"

on the input element. If I leave this out, everything runs fine.

Test.cshtml:

@model LoginViewModel

Test page running.
@{
    ViewData["Title"] = "Login";
}
<h1>@ViewData["Message"]</h1>

@try
{
    using (Html.BeginForm())
    {
        <input type="text" class="form-control" placeholder="Logincode" asp-for="LoginCode" />
    }
}
catch (Exception exc)
{
    exc.ToString();
}

public class LoginViewModel
{
    [Required]
    public string LoginCode { get; set; }
    [Required]
    public string Paswoord { get; set; }
}

public class HomeController : Controller
{
    public IActionResult Test()
    {
        return View("Test");
    }
}

Dockerfile:

FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY *.sln ./
COPY MyProjectName/MyProjectName.csproj MyProjectName/
RUN dotnet restore
COPY . .
WORKDIR /src/MyProjectName
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyProjectName.dll"]

Is this a bug in Docker, ASP.NET Core, or is this an error from my part? Is it in any way possible for me to fix this or find out where exactly the error occurs? I have similar ASP.NET Core apps running on the same Linux machine without problems and they do use the asp-for tag?

Can you add your Dockerfile for reference? Usually the ASP.NET Core Base image from are multi-targeted. Depending on the docker version it can pull the specific version of the image for Windows or Linux. You will need the image targeted for Linux to run on a Linux machine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM