How can I specify a custom icon for a Dock stack?
You need to change the icon of the folder that contains the items in the stack.  This can be done in several ways, but perhaps the easiest is to start by navigate to the folder of the stack, change that icon, and set the stack to display the folder instead of the contents. 

Click the stack, click "Open in Finder" in the stack, and then press the keystroke ⌘ + ▲.  The key press will take you "one level up" in the directory hierarchy so that you are now looking at the folder that houses the items in the stack.

Next, select the folder (If it's not already selected), and "get info" on it, by typing ⌘ + I, or right-clicking and selecting "Get Info".  At the top of this window will be a miniature icon of a folder.  You can click on this and copy it via the keyboard shortcut (⌘ + C), or paste in an image that you copied from somewhere else.

Finally, you need to right-click on the stack and set it to display "folder" and not the stack contents.