Is there a way to set the dock height in fixed pixels? I want to set the dock size to 40 pixels.

Is there anyway to do it in Yosemite?
The Dock height is delineated by the size of the icons on the Dock, called the tilesize.

To calculate the tilesize for a Dock height of 40 pixels (80 pixels on my Retina display):

                                                      

You can set the tilesize with the following command, replacing '29' with the size of icon you desire.

defaults write com.apple.Dock tilesize -int 29 &amp;&amp; killall -HUP Dock