yanpitangui/dotnet-api-boilerplate

[BUG] docker-compose issue

snax4a opened this issue · 5 comments

Hello,

Im trying to run this app on MacOs
As im not using windows In docker-compose.override.yml i only changed this lines :

    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

to use named volume:

    volumes:
      - boilerplatedata

Im not sure what are this strange volumes used for so it would be nice if you could explain it and tell me if i did it correctly.

When i run docker-compose up -d im getting this error:

Building boilerplate-api
Step 1/19 : FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
 ---> c3a51e51a0f9
Step 2/19 : WORKDIR /app
 ---> Using cache
 ---> 45e66bcf25b5
Step 3/19 : EXPOSE 80
 ---> Using cache
 ---> 5d8238c88e4f
Step 4/19 : EXPOSE 443
 ---> Using cache
 ---> aa14dc9dc80a

Step 5/19 : FROM mcr.microsoft.com/dotnet/sdk:5.0-buster AS build
ERROR: Service 'boilerplate-api' failed to build : manifest for mcr.microsoft.com/dotnet/sdk:5.0-buster not found: manifest unknown: manifest tagged by "5.0-buster" is not found

I could not find any informations how to fix this issue

Hi, @snax4a, thank you for your time!
This was caused by a misconfiguration in the dockerfile, and happened after I updated the .net version to 5.0. It is fixed now.
About the volumes, it was a way to share the trusted certificates from windows to the docker container. I added a step on the readme and removed those volumes. Now, you only need to share the created certificate.
Again, thank you for your contribution!

Can you please check that it works for you now?

It works now, containers are up, but when i try to access this route http://localhost:5000/api/hero
Im getting this error:

PlatformNotSupportedException: LocalDB is not supported on this platform.
Microsoft.Data.SqlClient.SNI.LocalDB.GetLocalDBConnectionString(string localDbInstance)
Microsoft.Data.SqlClient.SNI.SNIProxy.GetLocalDBDataSource(string fullServerName, out bool error)
Microsoft.Data.SqlClient.SNI.SNIProxy.CreateConnectionHandle(object callbackObject, string fullServerName, bool ignoreSniOpenTimeout, long timerExpire, out byte[] instanceName, ref byte[] spnBuffer, bool flushCache, bool async, bool parallel, bool isIntegratedSecurity, string cachedFQDN, ref SQLDNSInfo pendingDNSInfo)

I think there is wrong connection string set up in appsettings.json
"Data Source=(LocalDB)\\MSSQLLocalDB;Initial Catalog=HeroesDB;Integrated Security=True;"
It is pointing to some local db but it should point to this db-server container

@snax4a, you were correct. I fixed the connection string and created the initial migration, so now it executes on program startup.
Can you test again?

@yanpitangui Now everything works, thank you!