If stardocks are made available in the purchase queue/shipyard, buying one will work like base purchases do. You can then place the stardock/base in hexes as the limitations allow. Once set, they will appear on the map as the "jack" icon normally used for bases, but when someone enters the hex, they should see it as a stardock/shipyard. Attacking (or defending) it generates the Shipyard Assault mission. I haven't played it in a while, but last I recall it was incredibly easy. The stardock placement will result in a hex defense value boost based on a setting that determines the amount of boost by base type (setting could be zero, though).
Personally, I think the stardocks are not used enough in the game. They don't appear to affect economy, ship production, or availability of ships. I would have liked to see ships only available in stardock hexes, and only certain ones depending upon surrounding hex economy, but that will never happen with this game. Actually, I've never seen any docks other than the 1-bay type generated on the maps, though it makes little difference since they are not (to my knowledge) armed or appropriately defended. This can be changed in a server (or single-player) DefaultLoadOut.txt, at least.
Hope that helps.