When you pull a new latest, the old image loses its tag and becomes a nameless dangling image that the next prune removes. One extra tag before the pull keeps it findable.
docker tag example/app:latest example/app:rollback
docker compose pull app
docker compose up -d app
docker tag creates a second name for the same image ID. It costs no disk space. If the update misbehaves, point the service at example/app:rollback (or retag it as latest) and recreate the container, and you are back on the old version in seconds, without needing the registry.
I like this for images that only publish latest, where you cannot simply go back to a version number.
An image rollback is not a data rollback. If the new version migrated the database or changed files in its volume on first start, the old version may refuse to run on that data. For apps with a database, I would stop the container and back up the volume before the pull, not after. Also clean up the rollback tags once the new version has proven itself, because a tagged image is never removed by docker image prune and old ones quietly pile up.
Further reading: docker image tag