1

I want to make new Docker image which contains NodeJS and MongoDB. I have a nodeJS(latest) image. Dockerfile is

FROM node

RUN apt-get update
RUN apt-get install -y mongodb

EXPOSE 8800 
EXPORT 27017

If I build it, It is not working on two port(mongodb:27017, nodeJS:8800). Do I need to make Dockerfile on ubuntu Image, not a node Image?

FROM ubuntu:latest 
2
  • Per your comments in Mohsen's answer, may I suggest nodejs + 3rd party libs as architecture and therefore question title? Commented Jan 9, 2017 at 10:23
  • @qarma sure. what libs are you gonna suggest? Commented Jan 9, 2017 at 17:11

1 Answer 1

1

Do you want to run node server along side with Mongo? this is wrong in so many levels!

But if you want to use node image just for as your base image and don't need anything from node, then go with it! but it would be better to use ubuntu image because it takes much less space!

Sign up to request clarification or add additional context in comments.

8 Comments

My nodeJS app need to use "mongoimport" shell command which is only used in mongodb container.. So I want to install mongodb on node image
so install mongo-cli on your node container! you don't need mongod for this matter!
mongo-client doesn't have 'mongoimport' command... To use this command in nodeJS, I can create child-process => stackoverflow.com/q/27813783/6810726 . So mongodb and nodejs container should be same.
As you can see in here, you don't need to run it in the same server! run it with --host option! and let docker take care of the network thing!
You mean, connect nodeJS(8800) port to mongodb port(27017)? nodeJS container doesn't have mongoimport shell command.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.