I'd start by trying to reset the Dock first and then manually quitting and relaunching it. Note you will need to re-add any non-default icons (i.e. apps) that you've added to the Dock - so you may want to take a screenshot of your Dock as a reminder of what you had there. (Or start afresh and only add things as you actually use them).
Reset the Dock
To reset the Dock, follow these steps:
- Go to Finder
- Press and hold the option key down
- Now go to the Go menu
- Select the Library option to open the User's Library folder. You can let go of the option key now.
- Go to the Preferences folder (i.e. within the Library folder)
- Find and move the com.apple.dock.plist file to the Trash
Quit and relaunch the Dock
To quit and relaunch the Dock, follow these steps:
- Open Terminal (usually located in Applications > Utilities)
- Enter this command
killall -KILL Dock
- Press enter
Once you've done the above I'd restart your computer to see if the problem has been resolved. If it hasn't, then I'd try rebooting into Safe Mode to see if the problem is still present.
Boot into Safe Mode
Follow these steps to boot your Mac into Safe Mode:
- Fully shut down your Mac
- Restart your Mac
- Immediately press the Shift key and keep it down
- Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
- Take a note of what happens (i.e. is the Dock still misbehaving?)
- Exit Safe Mode by restarting your Mac as normal
- Test again to see what the Dock does
Let me know how you go.
[EDIT]
Since you've established that you don't have the problem in Safe Mode, but still do after logging in normally again, then it's time to investigate login items, fonts, and kernel extensions
Investigating login items, fonts, and kernel extensions
Let's start with Login Items:
- Startup normally
- Go to System Preferences > Users & Groups
- Select the Login Items tab
- Take a note of your Login Items
- Now remove all of them by highlighting them and clicking on the - button below
- Restart your computer
Now your Mac will boot up without those login items loading. Test this and see if the problem persists:
- If the problem goes away you know one (or more) of the Login items were causing the problem. You can then add them back in one by one until you've identified the culprit. Problem solved.
- If the problem does persist, it's either a problem with fonts you've installed yourself or with a 3rd party kernel extension. A little more info below:
Fonts:- You can remove any of the fonts you've installed yourself to see if this makes a difference.
Kernel Extensions:- You can open Terminal (found within your Utilites folder) and enter the following command:
kextstat | grep -v com.apple
The above command will list 3rd party kernel extensions (you may need to stretch the Terminal window so it's easier to read). Look for anything you don't remember installing, or something that belongs to software you've removed, or just anything that looks out of place. Remember though, this is a list of 3rd party kernel extensions and therefore any of them could be causing the problem.