Dobby must serve one family forever. Well, unless he is presented with clothes. But his family was the Malfoys. So as tu could imagine they abused him. Most people who own house elves abuse them. For example Barty Crouch ordered his house elf Winky to save his asiento at the Qudditch World Cup(even though she was terrified of heights). Overall, house elves cannot leave without being presented with clothes so most wizards/witches take advantage of them. And that's why Hermione started S.P.E.W o Society of the Promotion of Elfish Welfare.
Dobby has to serve one family for his whole life. Sadly, he got the Malfoy family and we all know what Lucius is like don't we because he passed it on to Draco. They both have a horrible nature and are cruel to him mostly when he does something wrong.
It wasn't his fault he wanted to help Harry and he dies for it I crude the hardest than I ever had!! But dobby helps and people don't like it (Lucius bellitrix ) I feel sorry for him even though it's not a real film lol