I'm attempting to run my ASP NET Core 3.1 API in a Linux Docker container. A component in my API requires a connection via ODBC to a server located on an external server. While in debug mode when I startup my API, the connection is attempted via ODBC but fails with the error "libodbc could not be loaded" I assume the ODBC drivers are missing in the Docker container.
I have searched online and I haven't been able to find how I would go about adding the missing library to my container or if maybe I need to download a different Base image. A copy of my docker file can be found below.
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["Sample.Service/Sample.Service.csproj", "Sample.Service/"]
COPY ["../Libs/ExternalServices.Configure/ExternalServices.Configure.csproj", "../Libs/ExternalServices.Configure/"]
RUN dotnet restore "Sample.Service/Sample.Service.csproj"
COPY . .
WORKDIR "/src/Sample.Service"
RUN dotnet build "Sample.Service.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Sample.Service.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Sample.Service.dll"]