There's a significant difference in the caloric needs of endotherms and ectotherms. Large reptiles that regulate their temperature externally can often survive on a single, large meal per year, where the largest endothermic omnivores eat every day, with the exception of when they hibernate. Think Nile crocodile and brown bear.
Other issues are that the crocodile has to live in tropical and subtropical regions where there is enough heat to keep it alive, while the bear can live pretty much anywhere. The crocodile also lives a very sedentary life, except for when it's eating and mating. Herding goats would require a greater expense of energy, which would in turn require more goats to be consumed, and thereby necessitate a larger herd. It wouldn't be worth it -- easier just to find one big goat a year and eat it.
For the bear, it's a different story. Needing to eat a big goat every week means he's in danger of starvation every week if he doesn't make that happen, so maintaining and defending a herd is a safer option.
As far as the goats being afraid of the dragon, that's a non-issue. On earth, goats have a natural fear of wolves, yet domestic dogs, which are a type of wolf, are used in two ways to work goats (and sheep). Herding dogs use the goats' fear of predators to control their movements on the pasture, while livestock guardian dogs (LGDs) are raised with the goats and the goats learn not to fear them. (Note that herding dogs and LGDs are not generally used together, as the LGDs, like the goats, would view herding dogs as predators and would kill them.) The goat can be conditioned not to fear any animal, and it's likely that beyond a certain size threshold, an animal would stop looking like a predator and start looking more, to a goat, like a large herbivore, since the largest animals on earth are herbivores, and it is not uncommon for goats and other mid-size grazers to share the pasture with larger animals, in captivity (horses and cattle) and in the wild (buffalo, rhinoceros, etc.)
Also bear in mind that in both ectotherms and endotherms, the larger the animal gets, the greater its volume to surface area ratio, which means that its capacity to maintain body temperature increases and its caloric needs per unit of mass decrease. Since body heat is lost through the skin, the less skin you have in relation to your thermal mass, the less heat you lose. In other words, it takes fewer calories to sustain a pound of elephant than it does to sustain a pound of mice.
In my experience a 500 pound tiger or lion eats about its own body weight in meat every month. Since some of the mass of the prey animal is bone, probably 30% on average, we can say that a 500 pound cat would need 7 or 8 100-pound goats per month.
I'd estimate the weight of a 20-foot dragon at 4000 pounds at the absolute most. Since it takes less food to sustain a pound of dragon than a pound of tiger, the number of goats required per month might be something like 35-40 goats per month. That means a minimum herd of about 500 does, to be safe, unless you go with a large breed and allow significant time for them to grow. It's a lot of goats and would require a lot of real estate. This is based on 100 pound goats at time of slaughter. You can raise them larger, it just takes longer for them to get to that size.
Cattle range as heavy as 3000 pounds, though 1500 for a steer at slaughter is more typical. Fewer animals to manage, but they still breed once a year, so you have to maintain a large number of animals all year long.
Rabbits reproduce every month, and can give birth to a dozen kits every time, and can reliably raise 6 kits to weaning time. Pound for pound, they produce the most meat with the least feed of any livestock, because they are so prolific. If I was inventing animals, for this purpose, I'd make them like very large rabbits, maybe something like a capybara, with the rabbits reproductive cycle. Or just invent goats that breed like rabbits. Of course, the larger an animal gets, the slower it grows and matures, and that means longer gestation too. You could compensate by having your giant rabbit only give birth to one offspring at a time. That way, a herd of 50, 100-pound rabbits might be enough to sustain a 4000 pound dragon.
Also, consider giant chickens. Then your dragons can have eggs too.