It was formed when Elwe, originally of the Teleri, got lost in the woods and met the Maia Melian, after which he settled along with some followers and did not continue to Valinor.
Elwe's relation to the Noldor (particularly the sons of Feanor) was always tense, especially after he found out about the Kinslaying at Alqualonde, and even more so after the kidnapping of Elwe's daughter Luthien by Celegorm and Curufin. Doriath did not send a force to most of the major battles against Morgoth, and in particular was conspicuously absent at the Nirnaeth Arnoediad, one reason for the elves' defeat.
Doriath was destroyed following the sack of Menegroth and the slaying of Elwe in clashes between the elves of Doriath and the dwarves of Nogrod over possession of the Nauglamir and the Silmaril which Elwe had placed within it. After Elwe was slain, Melian fled to Valinor and the surviving elves fled to Arvernien.