He’d be magically forced to obey any direct orders he was given.
Dobby only had a limited amount of free will about what he could do. House-elves can’t always help whether they betray their owners or not. They don’t need their master’s permission to do everything, and they can go against their owner’s wishes - as long as they weren’t specifically told not to do something. If they’re given a direct order, they’re magically forced to obey it. Kreacher is forced quiet by Harry telling him to shut up.
“Give him an order,’ said Dumbledore. ‘If he has passed into your ownership, he will have to obey. If not, then we shall have to think of some other means of keeping him from his rightful mistress.’
‘Won’t, won’t, won’t, WON’T!’
Kreacher’s voice had risen to a scream. Harry could think of nothing to say, except, ‘Kreacher, shut up!’
It looked for a moment as though Kreacher was going to choke. He grabbed his throat, his mouth still working furiously, his eyes bulging. After a few seconds of frantic gulping, he threw himself face forwards on to the carpet (Aunt Petunia whimpered) and beat the floor with his hands and feet, giving himself over to a violent, but entirely silent, tantrum.”
- Harry Potter and the Half-Blood Prince, Chapter 3 (Will and Won’t)
There’s no question of their moral willingness to obey or not - even though Kreacher considered serving Harry (who befriended Mudbloods, werewolves, and other sorts the Black family would disapprove of) a betrayal of his “true” masters, he was still forced to shut up. However, they are able to sneak around direct instructions. Depending on what Lucius told Dobby to do, he’d still be able to do everything he’d done to warn Harry. If they can think of a way around the direct order, then they can take those actions.
‘That’s the one,’ said Harry, foreseeing a great danger and determining to prevent it immediately. ‘And you’re forbidden to tip him off, Kreacher, or to show him what you’re up to, or to talk to him at all, or to write him messages, or … or to contact him in any way. Got it?’
He thought he could see Kreacher struggling to see a loophole in the instructions he had just been given, and waited. After a moment or two, and to Harry’s great satisfaction, Kreacher bowed deeply again and said, with bitter resentment, ‘Master thinks of everything and Kreacher must obey him even though Kreacher would much rather be the servant of the Malfoy boy, oh yes …”
- Harry Potter and the Half-Blood Prince, Chapter 19 (Elf Tails)
Kreacher was unable to find any loophole, so he was completely unable to tell Draco he was being spied on. It seems Lucius was less specific and Dobby had better luck finding one.
He may also be magically forced to keep his master’s secrets.
When Harry went to visit Dobby in the Hogwarts kitchens, Dobby tells him that part of being a house-elf is keeping their masters’ secrets.
“Can’t house-elves speak their minds about their masters, then?’ Harry asked.
‘Oh, no, sir, no,’ said Dobby, looking suddenly serious.‘’Tis part of the house-elf’s enslavement, sir. We keeps their secrets and our silence, sir, we upholds the family’s honour, and we never speaks ill of them – though Professor Dumbledore told Dobby he does not insist upon this.”
- Harry Potter and the Goblet of Fire, Chapter 21 (The House-Elf Liberation Front)
How Dobby acted is consistent with being magically forced to keep Lucius’s secrets - he warned Harry not to go back to Hogwarts and told him there was a plot against him, but he never said who was involved in the plot.
Because of these reasons, Dobby was likely unable to say more.
From what else we’ve seen about house-elves and the bindings that keep them obeying their masters (to a certain degree), Dobby was likely unable to do more. He could visit and warn Harry but couldn’t actually tell him “Lucius is plotting against you”, so he tried using hints. Even pointing to Lucius and the diary follows this pattern - he didn’t speak his master’s secrets.