My first guess would be an ear infection. My dog was doing the same thing and I was surprised to learn how deep the ear canal really is. His infection was so deep that it was not visible. How long has your dog been doing this? I would see a vet if it isn't getting better.