Dockerizing Express-MongoDB Atlas (docker-compose)

Viewed 872

My apologies if this is a noob question but, is it possible to configure a docker-compose file to get an already-existing Mongo Atlas database working as part of a docker network?

I have searched in internet but everyone is using new local mongodb connections or new mongodb Atlas ones.

(I have an express node forum running and its hosted on Atlas cloud db)

1 Answers

First of all you need to understand that MongoDB Atlas is a Cloud platform for MongoDB, so the database lives somewhere in the cloud, e.g. AWS.

While Docker network is a local network that Docker creates for you to encapsulate different containers into one net, thus making it possible to communicate between each other, and by the same token be isolated from world.

The answer is that you cannot make MongoDB Atlas part of your Docker network, because Atlas is not a Container that you could embed into your network. But the good news that you don't need to, because you can connect to the Atlas instance anyways from any computer, in condition that configuration of your Atlas allows to establish connections.

Related