Пожалуйста, обратитесь по ссылке ниже, где мой Dockerfile , run.sh файл и index.js файл с исходным кодом написан. Запустив этот Dockerfile, я получаю более старые версии, но я хочу установить Redis-4.0.1, node-10.15.3 и MongoDB-самая последняя версии
Примечание: это рабочий код.
https://stackoverflow.com/a/56875583/3815050
Dockerfile:
# Pull base image.
FROM ubuntu:14.04
# Install Node.js
RUN apt-get update
RUN apt-get install -y curl
RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install --yes nodejs
RUN apt-get install --yes build-essential
# Bundle angular app source
# Trouble with COPY http://stackoverflow.com/a/30405787/2926832
COPY . /src
# Install app dependencies
RUN cd /src
RUN npm install -g npm
#RUN npm install
# Binds to port 8080
EXPOSE 8080
# Installing redis server
RUN apt-get update && apt-get install -y redis-server
EXPOSE 6379
# Update the repository sources list
RUN apt-get update
# Install MongoDB.
RUN \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' > /etc/apt/sources.list.d/mongodb.list && \
apt-get update && \
apt-get install -y mongodb-org && \
rm -rf /var/lib/apt/lists/* && \
cd /
COPY index.js .
# Define mountable directories.
VOLUME ["/data/db"]
# Define working directory.
WORKDIR /data
# Define default command.
#CMD ["mongod"]
# Expose ports.
# - 27017: process
# - 28017: http
EXPOSE 27017
EXPOSE 28017
ADD run.sh /run.sh
RUN chmod +x /run.sh
# Defines your runtime(define default command)
# These commands unlike RUN (they are carried out in the construction of the container) are run when the container
#ENTRYPOINT ["/usr/bin/redis-server"]
#CMD ["node", "index.js"]
RUN apt-get update && apt-get install -y dos2unix && dos2unix /run.sh
CMD ["/run.sh"]
Код в файле run.sh:
#!/bin/bash
cd /data
/usr/bin/redis-server &
mongod &
node /index.js
Код в файле index.js:
console.log("helllllllooooo");