L
L
lucky42021-05-24 13:02:52
ASP.NET
lucky4, 2021-05-24 13:02:52

What are the ways the API works with the database, if the API is in Docker?

In general, I'm interested in how to solve such a problem.
There are two services that are driven into the docker. BUT, these services are connected to the mssql database via localbd.
If I turn to some endpoint that will work with db, I will get an error that there is no such database, and so on.

I tried to do as it was shown in the office. docker site, create a new docker-image with mssql. In docker-compose.yaml make a dependency and so on.

First I get the error: "mssql | This container is running as user mssql.
mssql | Your master database file is owned by mssql.
mssql | To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216 ."

Secondly, even if I can connect the database to this dckr container, I will not have any data, tables, etc. there. (I work with ef core migrations)

Well, the third question is: "maybe there is some other way to solve this problem?"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Kachan, 2021-05-25
@MANAB

Work with the database not as localbd, but placed on a separate server and connect via IP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question