Filipe Miranda Filipe Miranda - 3 years ago 85
Node.js Question

Docker Image with Mixin of Base Images

I would like to build a docker image that uses NodeJs and Java Runtime.

It is possible to find separate docker files, one for each base.

How can I use two bases to create a new image?

In this case, i am gonna run a Angular App, and a Spring App in the same image.

Any tips on how to have a single image with such requirements? Does it make sense?

n2o n2o
Answer Source

If this makes sense in your case is hard to judge from the outside. In general should an image do one thing, run one app in particular. Seems like you are mixing two things in one container. If you really want to do this, I'd choose the "more difficult to install" image and choose it as a base image (seems to be the Spring image). Then I'd add the packages for node.js, which should only be a few lines of code. Since most Dockerfiles are public, you can look up the images and build your own image for both apps.

But in general this sounds like you really need two images, one for the Angular stuff, one for the Spring stuff. You can then compose these images with docker-compose or manually by linking them if needed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download