Reputation: 11976
I'm currently trying to learn Docker on the "Projects in Docker - Eduonix Learning Solutions" video tutorial, when I build my app container the console returns me the ID of the app. So far everything it's okay. Then when I run immediatly container ls it displays the container. But after some second the container is not longer displayed in the list of containers.
when I run sudo docker ps -a
the container doesn't display neither.
I can't figure out why.
Here my Dockfile:
FROM node
RUN apt-get update -q && apt-get dist-upgrade -y && apt-get clean && apt-get autoclean
EXPOSE 3000
ENV APP_PATH /usr/share/app
RUN mkdir -p $APP_PATH && chown node:node $APP_PATH
WORKDIR $APP_PATH
USER node
COPY . $APP_PATH/
RUN npm install
CMD ["npm","start"]
if someone has any hint, would be great, thanks
Upvotes: 0
Views: 97
Reputation: 445
I would suggest you check the logs. It is possible to be an error in your JS app and it crashes at a short time after npm start is executed. So the container is made, it start, but it closes soon after. That's because docker container ls
is showing you only the running containers and you have to use docker container ls --all
to see the non-running ones. You can use docker logs to see check the logs or you can adapt the Dockerfile so that it will keep logs of your app, by changing the last line to:
RUN npm start | tee /logs/app.log
and then check that file
Upvotes: 1