Most containers I look at never need the extra kernel powers Docker hands them by default. --cap-drop ALL takes all of them away, and you add back only the one or two the app complains about.
Docker starts a container with a restricted set of Linux capabilities, an allowlist of things like binding low ports or changing file owners. The engine docs say the best practice is to remove all capabilities except the ones a process explicitly needs. The pair of flags below does exactly that, and the run reference is where you find them.
docker run -d --name web --cap-drop ALL --cap-add NET_BIND_SERVICE -p 8080:80 nginx
The first flag drops everything, the second gives back NET_BIND_SERVICE, which is what lets a process bind to ports below 1024. Whether an image needs more depends on the app. Nginx, for example, also wants to switch users and change ownership of its cache folders, so with this exact line it may refuse to start and you see a permission error in docker logs web. Add the missing capability named in the error (such as CHOWN, SETUID or SETGID) and try again.
I like this as a habit for containers that face the internet, because a compromised process then has far fewer tricks to play. In Compose the same thing is a cap_drop: list with cap_add: next to it.
There is no way to know the minimum set up front, so test on a throwaway container first, not on the one that runs your family photos. The error messages are usually clear, but some apps fail quietly and only break when you use a certain feature.
Further reading: docker run reference, Docker Engine security: kernel capabilities