Is there a way to NOT have icon automatically added to the dock? [duplicate]

Solution 1:

Try going to System Preferences > Dock & Menu Bar > Uncheck "Show recent application in Dock".