In my code in VSCODE i am able to connect to the mongod in the container and pull and insert data in different dbs and collections; however I deploy this service in a container and and use postman to hit the endpoint in the service. It hits the service but when its doing a db.collection.find() i get the following error:
Your app and db need to share a docker network. Beyond that I would suggest looking at the docker documentation. Docker compose can help you create application stacks.
I talked to a few other people and they also suggested the docker network. I tried to ping the the other container’s ip and didn’t get a response back. Based on the IP address structure they look to be on the same subnet.