I launched firefox from the Terminal with some command line arguments. It appears in the doc and now I want to change the icon from the firefox icon to something else and keep it in the dock. How do I do that?
You need to make a simple application that calls Firefox with the desired arguments. The simplest way to do this is to create an application running a shell script in Automator. The shell script should call your program with arguments, like this:
Save it as an application (not workflow) where you like. You can then change the application icon using Finder. Cmd+I on the application, click on the thumbnail, Cmd+V to paste your custom icon.
Then drag the newly created executable to the Dock.