'Running Net Core Api and MongoDb in the same container

I have a requirement to create a Net Core Api running in a docker container. Typically, I would link that to another container running MongoDb and run them both in the same Docker CLI together but seperate containers.

However, for this project I need to embed MongoDb inside the actual API project container and access it from the API as a local implementation (to that container).

I’ve been able to create the container for the API and part of that Dockerfile installs MongoDb - but I cant work out what my connection string for MongoDb needs to be - given that its running inside the container too. Could someone give me some pointers?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source