Take your dog to the vet. If he is not keeping food down and losing weight, it could be an obstruction.
Take him to the vet immediately.
I wound up having to switch to the Science Diet Sensitive Stomach dry food. My beagle was getting sick at least one stretch a month, same as yours, where she'd eat all of it, and then 10 minutes later throw it up. The new dog food seems to have helped, she's been on it about 2 years, and only had 1 of those stretches since.