I have a .Net Core 3.0 application using Scram Method to connect to Mongo DB Cloud Atlas instance without a problem when I run it. But I am getting the following error when I am trying to run the application within a Docker container.
“Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1.”
Here is my Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS base WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /src
COPY [“ShortUrl.API/ShortUrl.API.csproj”, “ShortUrl.API/”]
RUN dotnet restore “ShortUrl.API/ShortUrl.API.csproj”
COPY . .
RUN dotnet build “ShortUrl.API.csproj” -c Release -o /app/build
FROM build AS publish RUN dotnet publish “ShortUrl.API.csproj” -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT [“dotnet”, “ShortUrl.API.dll”]
Here are the commands I am building and running container.
docker build -t urlshortenerservice:v3 .
docker run -it -p 5500:80 urlshortenerservice:v3