From OS X Daily. Follow the headline link for a detailed walkthrough.
In a nutshell, go to Terminal and enter:
defaults write com.apple.dock static-only -bool true; killall Dock
To return to normal:
defaults write com.apple.dock static-only -bool false; killall Dock
This has been around a long time, but I’ve never encountered anyone using it. Would love an option to put all running apps in its own section of the dock, as is done with recently used applications. There a setting for that?