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

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.