Is it the correct dockerfile to install centos with mongodb?
I need to install centos with mongodb and after I must configure nodebb so I create dockerfile:
FROM centos:latest RUN yum -y update ; yum clean all RUN yum -y install epel-release tar ; yum clean all RUN yum -y install wget ; yum clean all RUN yum -y groupinstall "Development Tools" RUN yum -y install nodejs git ImageMagick npm RUN yum -y install openssl openssl-devel RUN yum -y update; yum clean all RUN yum -y install mongodb-server; yum clean all RUN mkdir -p /data/db RUN cd /opt ; git clone -b v1.2.1 https://github.com/NodeBB/NodeBB nodebb RUN cd /opt/nodebb ; npm install VOLUME /opt/nodebb # Define a working directory WORKDIR /opt/nodebb # Expose ports EXPOSE 80 EXPOSE 443 EXPOSE 4567 EXPOSE 27017 CMD [ "node", "app.js" ]
After that I do
sudo docker build -t centos .
sudo docker run -i -t centos /bin/bash
I go in the correct folder and I do
I put all parameter but at the end of process I obtain
NodeBB could not connect to your Mongo database. Mongo returned the following error: connect ECONNREFUSED 127.0.0.1:27017 5/4 12:34  - warn: NodeBB Setup Aborted. Error: connect ECONNREFUSED 127.0.0.1:27017 at Object.exports._errnoException (util.js:1022:11) at exports._exceptionWithHostPort (util.js:1045:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
Anyone can help me?
@Doppy This is not how you're supposed to use Docker.
One process should run per container so one for mongo (use the
mongodbimage) and one for nodebb.
You would link the nodebb one to the mongo one and you're done.
@Telokis and after that I have created two containers How can I do? I must mount some volumes?
Take a look at my image here : https://hub.docker.com/r/ninetainedo/nodebb/
@Doppy Forgot to mention you !