Need solution regarding images

Hi guys, I’m new to docker and have an basic issue. I’m trying to build an image which has Cassandra DB and a Nodejs Microservice querying data from the DB.

So far I have acheived to create two images one for DB and other for nodejs service. Now I know that we cannot merge two images to get one image.
So how can I have both DB and nodejs service running in one image? or is there any other way of acheving it?

Thanks

Hey, so the only way to do what you want to do is to merge both your Cassandra and Nodejs Dockerfiles into one Dockerfile. Hope that helps!

Thank you for the solution.
I have not written any Dockerfiles for nodejs and cassandra. I did it by one command at a time seeing an online tutorial.
I searched online for some tips but I’m still confused about creating a docker file which has Ubuntu, Cassandra, Nodejs and Npm.

If possible can you kindly guide me with an sample Docker file for my usecase.
So far I have accomplished this Dockerfile,

Set the base image to Ubuntu

FROM ubuntu
#####File Author / Maintainer
MAINTAINER sid
#####Install Node.js and other dependencies
RUN apt-get update &&
apt-get -y install nodejs &&
apt-get -y install nodejs-legacy &&
apt-get -y install npm
#####Provides cached layer for node_modules #Run npm install in a temporary directory and copy to src (for caching node_modules)
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /src && cp -a /tmp/node_modules /src/
#####Define working directory #Copy the application source from the host directory to src within the container
WORKDIR /src
ADD . /src

Expose port

EXPOSE 8080

Please refer