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 known as the Sept of Remembrance was built on the Hill of Rhaenys, which was formerly the main sept in King's Landing. During the Faith Militant uprising, Maegor the Cruel, mounted on Balerion the Black Dread, incinerated the sept with dragonflame, and later decreed that a large domed structure would be built on the hill for House Targaryen 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.
After Maegor's death, his successor Jaehaerys I Targaryen decided to complete the Dragonpit. When staying in King's Landing, the young king kept his own dragon, Vermithor, in the stables at the Red Keep itself for several years. The partially constructed Dragonpit was where the marriage rites of the Hand of the King, Lord Rogar Baratheon of Storm's End and the Queen Regent, Alyssa Velaryon were performed by the Hign Septon during the Golden Wedding in 48 AC.
Construction on the pit was finally completed in 55 AC and a great tourney and melee were held in celebration, with the victor of the melee being a young knight from the riverlands named Ser Lucamore Strong. 
In 56 AC, Balerion returned to Westeros with the dying Princess Aerea on his back from the accursed ruins of Valyria. Jaehaerys had Balerion confined to the Dragonpit. The Dragonpit and the royal dragons (along with any dragon eggs) in the pit were to be guarded by a new order of seventy-seven warriors who became known as the Dragonkeepers. 
The Princess and the Queen
King Aegon II's coronation took place in the Dragonpit.
During the Targaryen civil war known as the Dance of the Dragons, the Dragonpit was destroyed during the Storming of the Dragonpit, when tens 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 ten 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 blackened 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. 
- A Storm of Swords, Chapter 8, Daenerys I.
- The Sworn Sword, Legends II, ISBN 978-0345456441.
- A Game of Thrones, Chapter 18, Catelyn IV.
- A Game of Thrones, Chapter 67, Sansa VI.
- The World of Ice & Fire, Maegor I.
- Fire & Blood, The Year of the Three Brides- 49 AC.
- Fire & Blood, Birth, Death and Betrayal under Jaehaerys I.
- These three younger dragons extant by 56 AC may have been Vhagar, Caraxes, and Meleys, the three dragons later claimed by Jaehaerys's children. Other smaller to medium sized dragons during the Dance 75 years afterwards probably weren't alive at this time as they weren't mentioned until much later, except possibly Syrax (Rhaenyra's dragon, who wasn't claimed by a rider until after Jaehaerys's children). Sheepstealer and the Cannibal were alive at this time, but wild dragons never kept in the Dragonpit. Dreamfyre was another older dragon alive at this time, but at that point she was with Princess Rhaena at Harrenhal.
- The Princess and the Queen.
- A Clash of Kings, Chapter 49, Tyrion XI.