Is there a way to set the dock height in fixed pixels?

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 && killall -HUP Dock