The Targaryens would keep their dragons within the building. Thirty knights could ride abreast into its entrance. No pit dragon ever reached the size of the dragons who were raised before the construction of the building. When living dragons still nested beneath the dome light would shine through the windows at night. 
Prior to the Dragonpit, a great Sept was built on Rhaeny's Hill known as the Sept of Remembrance which used to be the main Sept in King's Landing. During the Faith Militant uprising, Maegor the Cruel, mounted on Balerion the Black Dread, incinerated the Great Sept with dragonflame and later decreed that a large domed structure would be built on the hill for Targaryens to house its royal dragons. Because Maegor had killed all those who had built the Red Keep to hide its secrets, many fled rather than work on the Dragonpit. Maegor had to use city prisoners, with supervisors from Myr and Volantis.
The Princess and the Queen
King Aegon II's coronation took place in the Dragonpit.
Later during the Targaryen civil war known as the Dance of the Dragons after King's Landing was captured by Queen Rhaenyra, the Dragonpit was destroyed during the Storming of the Dragonpit. When ten's of thousands of crazed and starving smallfolk led by the deranged Shepherd stormed the dragonpit to kill the dragons within. Five Targaryen dragons (Shrykos, Morghul, Tyraxes, Dreamfyre and Syrax) and thousands of smallfolk were killed.
The dragonpit was reduced to flaming ruins.
The Sworn Sword
During the Great Spring Sickness so many people died so quickly that there was no time to bury the bodies. Instead they were piled up in the Dragonpit and when the corpses were 10 feet deep the Hand of the King, Lord Brynden Rivers, ordered the pyromancers to burn them. The light of the fires shone through the windows and by night citizens could see the dark green glow of wildfire all through King's Landing. 
A Game of Thrones
Aboard the Storm Dancer as she is about to dock in King's Landing, Catelyn Stark takes in the view of King's Landing. Across it she can see atop Rhaenys's Hill the blacked walls of the Dragonpit, its huge dome collapsed in ruin.
A Storm of Swords
A Clash of Kings
Some whores use the Dragonpit as a place to entertain their customers and one of them, along with their patron, falls through the floor. There they find a hidden stash of wildfire, placed by Lord Rossart during Robert's Rebellion.
A Dance with Dragons
In Meereen, just before attempting to steal Rhaegal and Viserion, Quentyn Martell recalls readings that suggested that the confines of the Dragonpit had slowed the growth of dragons kept there - none of the dragons bred and raised in the Dragonpit had ever approached the size of Vhagar or Meraxes, much less the Black Dread, King Aegon I Targaryen's monster.
In King's Landing, your ancestors raised an immense domed castle for their dragons. The Dragonpit, it is called. It still stands atop the Hill of Rhaenys, though all in ruins now. That is where the royal dragons dwelt in days of yore, and a cavernous dwelling it was, with iron doors so wide that thirty knights could ride through them abreast. Yet even so, it was noted that none of the pit dragons ever reached the size of their ancestors. The maesters say it was because of the walls around them, and the great dome above their heads.