Docker Container gets down after an error shows up

I am developing a django project and the server is run by a docker container

When there is an error in the code like a “syntax error”. Docker logs shows that error and then shuts it self. The problem is until yesterday when I fix the error the docker log was showing “backend-1 | Watching for file changes with StatReloader” and I could still connect the server.

How can I fix this problem?

I run the container with
“docker-compose up”

If you have a syntax error, find out where. If an error happens in the container and the main process terminates, or can’t even start, the container will die as a container is the isolation of the process. There is no container without the process to isolate.

Sice you added “windows” to the tags of the topic, I assume you use Docker Desktop for Windows. If it is the case, docker-compose is an alias to docker compose, but otherwise the second form is what you should use as the old is not supported anymore…