What is the difference between the `--build` and `--force-recreate` flags to `docker-compose up`?

As mentioned in a doc, or the help of docker-compose up,

--build: build images before starting containers.

--force-recreate: Recreate containers even if their configuration and image haven't changed.

--build is a straightforward and it will create the docker images before starting the containers. The --force-recreate flag will stop the currently running containers forcefully and spin up all the containers again even if you do not have changed anything into it's configuration. So, if there are any changes, those will be picked-up into the newly created containers while preserving the state of volumes. The counter to this is --no-recreate to keep the containers in their existing state and it will not consider the respective changes into the configuration.

Hope this helps.