node.jsmongodbexpressdockernodebb

Using Docker to build an image for Node, my Express based Node app, MongoDb, and NodeBB, connected via Passport


I've just been introduced to Docker and the concept is awesome. I've found simple Dockerfiles for building an image for MongoDB and Node and was wondering, do I just combine those images together to make one image that has my project which is a combination of a custom Node app (built on Express), a NodeBB forum, backed by MongoDB, all wired together with Passport providing single-sign-on. Or should I make them all separate Images.

Can a Docker image contain its own VPN with the various services running on different VMs?


Solution

  • Docker does not have a standardized way to package and provision applications consisting of multiple images, so if you want to share your application, it's probably best to put everything into a single Dockerfile. Having said that, if sharing your application isn't a huge priority using multiple Docker images may be easier to maintain (plus you'll be able to use other MongoDB images). You could then use something like Fig (http://orchardup.github.io/fig/) to orchestrate the entire application.

    As for communication between Docker containers, Docker has two options: enabling all communication across containers (this is the default), or disabling all communication except for those specified. You can enable the second option by passing the flag "--icc=false" to the Docker daemon. Afterwards, you'll need to explicitly "expose" and "link" containers in order for them to communicate. The relevant documentation can be found here.