Docker compose allows you very unrestrictive naming of your environment variables. It allows you to use hyphen and other "special" characters in variables names. When you need to use these variables in regular shell you are out of luck, bash and many other shells do not allow hyphens in variable names. But this is merely a shell restriction, so how to do it?
env -i 'TZ=Europe/Berlin' \
'DB_PASSWORD=password' java -jar myapp.jar