在'/ app /'docker-compose中找不到执行应用程序所需的库'libhostpolicy.so'

时间:2018-11-28 11:44:27

标签: docker docker-compose asp.net-core-2.1

当我想在docker-compose.yml中获得我的一项服务时,出现此错误。

  

“执行应用程序所需的库'libhostpolicy.so'   在“ / app /”中找不到

我的Dockerfile是

FROM microsoft/dotnet:2.1-sdk AS build

WORKDIR /app

COPY . .

RUN dotnet restore

RUN dotnet build --output /out/ --configuration Release

FROM microsoft/aspnetcore:2.0.0 

COPY --from=build /out /app/

WORKDIR /app  

ENTRYPOINT ["dotnet", "ProductCatalogApi.dll"]

我的docker-compose.yml

version: "3.2"
networks:
   frontend: 
   backend:

services:
   catalog:
      build:
         context: .\src\Services\ProductCatalogApi
         dockerfile: Dockerfile
      image: shoes/catalog
      environment:
         - DatabaseServer=mssqlserver
         - DatabaseName=CatalogDb
         - DatabaseUser=sa
         - DatabaseUserPassword=ProductApi(!)
      container_name: catalogapi
      ports:
         - "8080:80"
      networks:
         - backend
         - frontend
      depends_on:
         - mssqlserver

   mssqlserver:
      image: "microsoft/mssql-server-linux:latest"
      ports:
         - "1445:1433"

      container_name: mssqlcontainer
      environment:
         - ACCEPT_EULA=Y
         - SA_PASSWORD=ProductApi(!)
      networks:
         - backend

我的ProductCatalogApi.csproj就像

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <RootNamespace>ShoesOnContainers.Services.ProductCatalogApi</RootNamespace>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
    <RuntimeFrameworkVersion>2.1.6</RuntimeFrameworkVersion>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.6" />
    <PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.6" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />

  </ItemGroup>

</Project>

正如我说的那样,当我运行“ docker-compose up catalog”时,出现标题中指定的错误。问题可能与.net核心版本有关。

但是我无法解决问题。有谁知道为什么会这样?

我安装了2.1.403和2.1.500版本的dotnet sdk。

顺便说一下,我在Powershell上运行docker-compose build时,它的构建没有错误。

谢谢。

0 个答案:

没有答案