A space dock is a (currently fictional) type of 'dry dock' for spaceships or starships, which would most likely be located in a low planetary orbit. However, concept work has been undertaken on real space dock facilities that could be built with current technology.
In both real-world as well as fictional use, they provide dedicated facilities to repair or build spacecraft, bypassing the need to lift materials from a gravity well (or allowing these materials to be lifted in smaller, more manageable loads), respectively avoiding the need for an existing spacecraft to make a planetary landing for maintenance.
Space docks, as part of a wider space logistics infrastructure, are considered a relevant part of a true space-faring society. Scientists of the American Institute of Aeronautics and Astronautics have proposed that future, near-term LEO space facilities should include "a large space dock making possible the on-orbit assembly and maintenance of large space facilities, space platforms, and spacecraft" (see image for design concept). A space dock / hangar could also allow enclosed (and possibly pressurized) maintenance of smaller spacecraft and space planes, though the construction of non-atmospheric spacecraft and other space facilities is envisaged as its main use. The structural strength of such a more advanced hangar would primarily be based on the internal atmospheric pressure that would have to be sustained for shirt-sleeve operations, thus enabling routine servicing and assembly in space.
The use for orbital maintenance could be especially critical for damaged atmospheric spacecraft, which are at great risk during reentry into the atmosphere, as was shown during the Columbia disaster. In the wake of the disaster, NASA improvised repairs to shuttles while in flight, a procedure which would have been much easier with a dedicated orbital facility. The use of a major space dock as a construction facility would also be required for the construction of an interstellar colonization starship built with current or near-term technology.
Future Ares V missions for example could serve to cost-effectively transport construction materials for future spacecraft and space exploration missions, delivering raw materials to a Moon-based space dock positioned as a counterweight to a Moon-based space elevator.
Space docks in science fiction play an important role in the construction and maintenance of space vessels. They add a depth of realism to the fictional worlds they appear in and continue the nautical parallels that most space-based science fiction uses. Space docks serve the same purpose as their non-fictional terrestrial dry dock counterparts, being used for construction, repairs, refits and restorations of spacecraft. Some play significant plot roles, others hide in the background in many sci-fi media.
Space docks of varying styles and sizes have made a number of appearances in the Star Trek science fiction universe. Often they were shown as open, metal framed structures in which a vessel could be docked. The first such drydock was seen in Star Trek: The Motion Picture with the refit USS Enterprise (NCC-1701) contained within such an "orbital dockyard" before being sent to intercept an alien vessel on course for Earth — "chronogically" speaking in the storyline, an earlier example (set in 2151) also housed the first Enterprise of Capt. Jonathan Archer at the start of the Star Trek: Enterprise series.
A larger facility, known as Earth Spacedock was seen for the first time in Star Trek III: The Search for Spock. These were huge orbital command installations incorporating internal space docks that could be completely enclosed - starships could enter through bay doors to receive supplies or maintenance.
A third type of space dock was seen occasionally in The Next Generation and following series. This type of dock had a large command pod at the top, with arms underneath that could house a starship. The Enterprise-D was refitted and repaired in such a dock following combat with the Borg in 2367.
Dock facilities were occasionally seen on the Babylon 5 television series and movies. In the Babylon 5 universe, the space docks were structures deployed outside the station when larger ships were in need of repair. The Babylon-station itself effectively served as a Space dock with internal docking facilities for freighters, personal transport vessels and its own complement of fighter-craft designated to protect the station.
During the events of the movie A Call to Arms, the Excalibur and the Victory were shown in the dry dock facilities in which they were constructed. The dock was destroyed by the Drakh following their attack on Earth, which would halt the construction of further Victory class destroyers until the facilities could be rebuilt.