I'm containerizing a nodejs app. My Dockerfile looks like this:
ADD ./ /egp
RUN cd /egp \
&& apt-get update \
&& apt-get install -y r-base python-dev python-matplotlib python-pil python-pip \
&& ./init.R \
&& pip install wordcloud \
&& echo "ABOUT TO do NPM" \
&& npm install -g bower gulp \
&& echo "JUST FINISHED ALL INSTALLATION"
# CMD npm start > app.log
CMD ["npm", "start", ">", "app.log"]
docker run -it -p 5000:5000 -v $(pwd):/egp node:4-onbuild /bin/bash
docker build .
The node:4-onbuild image contains the following Dockerfile
FROM node:4.4.7 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app ONBUILD COPY package.json /usr/src/app/ ONBUILD RUN npm install ONBUILD COPY . /usr/src/app CMD [ "npm", "start" ]
ONBUILD commands run before your ADD or RUN command are kicked off, and the endless loop appears to come from the
npm install command that's running. When you launch the container directly, the
ONBUILD commands are skipped since you didn't build a child-image. Change your
FROM line to:
and you should have your expected results.