Do you use xDebug for Magento 2 development ? Do you miss it in case of install or upgrade scripts ? In case you using docker for development, you are on right place.
All you need to do, while you are running
setup:upgrade console command is to put this code in front of it
Where [xDebug key] is key which you are using for xDebug identification. So in case you are using key “phpstorm”, you complete console command will be
XDEBUG_CONFIG=idekey=phpstorm php bin/magento setup:upgrade
This article is based on article from magentoformat.com