Docker Community Forums

Share and learn in the Docker community.

Docker Compose multiple apps using same mongodb service


(Ryan Watts) #1

Is it possible to use the same mongodb service for multiple applications.
For example I am using docker compose for each project. However I do not need to create an nginx, and mongodb container for each application.

I would like all 5 applications to use the same nginx, and mongodb services that are created.

I’m attempting to simulate my development environment as closely as possible with my local environment. Ideally we wouldnt install mongodb 5 times for each application.

How simple is this task to accomplish, or simply put does docker compose already do this if the service name is the same for each application I deploy.


(Dvohra) #2

Expose the mongodb service at an endpoint and access the endpoint from each of the 5 applications.


(Ryan Watts) #3

Thank you, I will give that a try.