Docker Community Forums

Share and learn in the Docker community.

Runing docker-compse up gives errrors

I am running docker-compose in Ubuntu.

I have build a “stupid” react application just to get to know docker.

when running the command :slight_smile:
docker run -it -p 3000:3000 -v /app/node_modules -v $(pwd):/app 638c43545267
everything works fine.

When I dry to use my docker-compose file like this
docker-compose up --build

I get the following errors:
Recreating frontend_web_1 … done
Attaching to frontend_web_1
**web_1 | **
web_1 | > frontend@0.1.0 start /app
web_1 | > react-scripts start
**web_1 | **
web_1 | :information_source: 「wds」: Project is running at
**web_1 | :information_source: 「wds」: webpack output is served from **
web_1 | :information_source: 「wds」: Content not from webpack is served from /app/public
web_1 | :information_source: 「wds」: 404s will fallback to /
web_1 | Starting the development server…
**web_1 | **
frontend_web_1 exited with code 0

the docker-compose config is:
version: ‘3’
context: .
- “3000:3000”
- /app/node_modules
- .:/app

Does anybody know how to solve it?

Thanks in advance

This is not an error, your app just exits because it has nothing to do.
It is difficult to answer your question in detail because you don’t show us your Dockerfile. And if you’re going to show it please format it and the compose file as code so we can read it.

I had the same unhelpful error when I tried to run docker-compose on Windows from a project I created in Linux. If you clone a Linux project on Windows, by default Git adds Windows style line endings which mess up any Bash scripts. If this is the case run git config --global core.autocrlf false to configure Git to never change the line endings. Then delete repository and re-clone it.

Alternatively if you created the project initially on Windows, many times the IDE adds Windows style line endings. If this is the case then in Notepad++, Click edit menu > EOL Conversion > Unix.