Recently I am using docker container where I have installed node.JS project, But I did not mention or used MongoDB image in docker container, I would like to connect hosted MongoDB Database using URL. We have made MongoDB URL and put it inside the .env file but it doesn't connect to the MongoDB database. But If I use MongoDB Atlas/cloud link it works. Is there any option to connect it this way?
here is my Docker code for the server below
FROM node:14.5.0
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 9000
CMD ["npm","start"]