Question

Running Nodejs & MongoDB on the same container/instance?

Hi. I’m new into the world of Docker/Kubernetes (or any container system in general).

I have a NodeJS application (a little CMS) using MongoDB. I want it to be simple to duplicate, configure and customize.

I always hosted my applications on Ubuntu VM, but configuring and doing maintenance is very time consuming.

So I wanted to use the new Digital Ocean App feature to deploy my NodeJS app quickly (and being able to configure and duplicate the same application for multiple clients of mine). But this doesn’t allow me to host my MongoDB database with it (and Digital Ocean doesn’t have MongoDB in his offer, and I don’t want to have it on another host).

So I tried to put my application on Docker, but it seems that digital ocean counts one docker service as a single VM. So I’m unable to have both my NodeJS and MongoDB containers running on the same “server”.

Can Kubernetes can solve this problem or am I doing something wrong?

I don’t really care about performances, instances, microservices and such. My application is simple. If it starts to slow down, I just want to be able to purpose to my client to just buy a better server and do a Digital Ocean API call for it.

Thank you for your help.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Elijah Omolo
DigitalOcean Employee
DigitalOcean Employee badge
April 3, 2021
Accepted Answer

Thanks for your question! Using Kubernetes would achieve the goal of having both your nodeJS and MongoDb containers running on a single instance. Here is a tutorial that contains instructions on how to configure this on our platform.

Regards, eomolo

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel