docker-compose-f docker-compose.yml up-d --build The frontend container starts after execution.
docker-compose-f docker-compose.yml up-d --build, check
docker ps-a to see the frontend container as STATUS itExited(1) 」.
docker-compose logs results in the following:
After removing the "CMD yarn start" in the Dockerfile from the above results and accessing the terminal with
docker run, we were able to confirm that "node_modules" exists and that "react-scripts" exists.
yarn start can be started in this state.
Windows 11 Home Memory: 16GB Docker Desktopdocker docker-compose yarn
The container image generated by docker build appears to contain
node_modiles, but it seems to be overwritten and not present because it binds the local file
docker-composer run (or exec) instead of
docker run to ensure that you are aligned with the failed situation.
The solution is to run
docker-compose run --rmyarn and try again with yarn install bound mounted.(The node_modules are written outside the container.)
By the way, the error content is slightly different between the title and the text, but is it a transcription error?
© 2022 OneMinuteCode. All rights reserved.