I have a bit of a problem with the NodeJS that is shutting down after a few seconds from the moment the run command had started to execute.
For a start, I had created a react project by running the command create-react-app <my_project_name>
. After this, in the project folder, I had created a docker file named Dockerfile.dev. that looks like:
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
And compiled it with the command docker build -f Dockerfile.dev -t emy.
The build was a success, but when it had come to run it with the command docker run -p 127.0.0.1:3000:3000 emy
. The container is self shutting down after a few seconds.
This is the structure of the generated project:
And the output of the docker running command for git bash terminal : And for the window terminal :
The container exit code is 0. So it's normal...
Steps to reproduce the problem :
1) Install NodeJS .
2) Install react project generator .
3) Create a project by running the command create-react-app <my_project_name>
in the window terminal.
4) Step into the newly created project, with cd <my_project_name>
5) Create Docker file with the content that you can find above.
6) Build the container by running the command docker build -t emy.
7) Now let's reproduce the problem by running the container with the command docker run -p 127.0.0.1:3000:3000 emy
8) Wait 5 seconds (max) and you should have the same problem us me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.