<p>I'm pulling my hair out for a week but I am close to giving up. Please share your wisdom. </p>

<p>This is my Docker file: </p>

<pre><code>FROM node
RUN apt-get update

RUN mkdir -p /var/www/stationconnect
RUN mkdir -p /var/log/node


WORKDIR /var/www/stationconnect
COPY stationconnect /var/www/stationconnect
RUN chown node:node /var/log/node
COPY ./stationconnect_fromstage/api/config /var/www/stationconnect/api/config
COPY ./etc/stationconnect /etc/stationconnect
WORKDIR /var/www/stationconnect/api 
RUN cd /var/www/stationconnect/api
RUN npm install

RUN apt-get install -y vim nano 
RUN npm install supervisor forever -g


EXPOSE 8888

USER node

WORKDIR /var/www/stationconnect/api

CMD ["bash"]
</code></pre>

<p>It works fine in docker alone running e.g.</p>

<pre><code>docker run -it  6bcee4528c7c
</code></pre>

<p>Any advice?</p>

<p>When create a container, you should have a foreground process to keep the container alive.</p>

<p>What i’ve done is add a shell script line 
<code>while true; do sleep 1000; done</code> at the end of my <strong>docker-entrypoint.sh</strong>, and refer to it in <code>ENTRYPOINT [/docker-entrypoint.sh]</code></p>

<p>Take a look at <a href="https://stackoverflow.com/questions/25775266/how-to-keep-docker-container-running-after-starting-services">this issue</a> to find out more.</p>

<p>There’s an <a href="https://nodejs.org/en/docs/guides/nodejs-docker-webapp/" rel="nofollow noreferrer">example</a> how to make a Nodejs dockerfile, be sure to check it out.</p>
