According to Dr. Laura Robinson, DVM, ear infections are really common, especially in dogs that are prone to allergies. Breeds that get ear infections most commonly include labradors, cocker spaniels, basset hounds, and breeds with longer ears that trap bacteria.
Ear infections can occur due to an underlying allergy, so trying different foods with various allergens can help determine if an allergy is the cause. Cleaning and drying your dog's ears properly whenever they come into contact with water will also help limit infections. Make sure you use an ear cleaner with a drying component.
Unfortunately, there is not a lot you can do at home if the infection has already begun effecting the ear. You will need to get drops, oral antibiotics, or sometimes even a steroid injection from your vet, which is why preventative care is so important.