I am reasonably new to react application.
docker-compose command 'npm start' does not start react app automatically?
package.json:
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
docker-compose:
.....:
command: bash -c "npm start && nginx -g 'daemon off;' "
Log Output:
portals_1 |
portals_1 | > myreact@0.1.0 start /~/~/myreact
portals_1 | > react-scripts start
portals_1 |
portals_1 | ℹ 「wds」: Project is running at http://172.18.0.9/
portals_1 | ℹ 「wds」: webpack output is served from
portals_1 | ℹ 「wds」: Content not from webpack is served from /~/~/myreact/public
portals_1 | ℹ 「wds」: 404s will fallback to /
portals_1 | Starting the development server...
portals_1 |
At this point, docker container runs but react server does not. However if I bash into docker container
docker-compose exec portals bash
I check that port 3000 is still free. If I go to the directory and run npm start then react runs normally and everything is as expected.
Log Output: - You can now view myreact in the browser.
Local: http://localhost:3000
On Your Network: http://172.18.0.9:3000
Note that the development build is not optimized.
To create a production build, use npm run build.......
Why react application is not able to start normally from docker-compose?