Access DB from .Net Core Docker build

  • fennng 
When we build to docker container using Visual studio, Visual studio will create a new network for the .net core app. 
You can also setup db in the yml file, so that DB can be created in the same network. 
But If you already have a DB setup in a docker container which is in a different network as I do, how can you access this db?
Here is the solution:
Add your .net core app to both of the network. For example, I have my db container in my-net network. I ran the following command to add the .net app to this network
docker network connect



标签:

发表评论

邮箱地址不会被公开。 必填项已用*标注