From 1940 to 1945 - most of France was occupied by the Nazis. Hitler planned to rule the world for one thousand years and it appears that he planned to do much of it from France. He heavily fortified the entire French Coast.
The subs rode these trolleys into the sub pens in K1 and K2.
Thanks to the UBoat fleet - Hitler very nearly won the war in 1942. He had built a series of fortified submarine pens along the coast at Brest - St Nazaire - Bordeaux - etc. The Uboats could sail into the underground pens undetected - where they could be refurbished and reloaded. The pens were self-sufficient. They had their own supplies of fuel - electricity - water - and food. As a matter of fact - when the Nazis surrendered in Reims - the troops in the submarine pens refused to come out. The Allies solved that problem by completely leveling the city of Lorient - nothing was left standing. The base would have nothing to support it.