Your dog could have a bad inner ear infection or cold. A dog will shake his head when his ears itch or hurt. A cold with lots of congestion can also cause ear issues. If the infection or cold is bad enough it could cause vomiting and loss of appetite.
He could have something else, but this sounds like it might be rabies, especially if he has not had all his shots. Take him to the vet as soon as possible.