Someone hands you a Compose file with a dozen ${...} placeholders. Before you start it, you want to know which of them you have to fill in. Compose can tell you.
docker compose config --variables
The output is a small table with the variable name, whether it is required, the default value and the alternate value. For a file like this:
services:
db:
image: mariadb:10.11
environment:
MARIADB_ROOT_PASSWORD: ${DB_PASS:?set DB_PASS}
TZ: ${TZ:-UTC}
it reports DB_PASS as required with no default, and TZ as optional with UTC. That is the shopping list for your .env file.
What I like is that it works even when a required variable is missing. A normal docker compose config stops with an error at the first missing value, while this listing just shows you all of them at once.
It only knows about variables that appear in the Compose file. Settings that the image reads at runtime, like a PUID the app expects, are not listed unless the file mentions them, so the image documentation still matters. The flag is fairly new, so an older Compose version will reject it as unknown.
Further reading: docker compose config