Hi..thanks for your query.
I think the concern here is a kind of folliculitis
affecting your scalp
.Folliculitis is the inflammation of a hair follicle caused by bacterial or viral infection, chemical irritation, or even a physical injury
.Lesions usually consist of asymptomatic erythematous perifollicular papules or pustules, but pustules may be painful or itchy and surrounded by erythema.
The most common form of infectious folliculitis is staphylococcal folliculitis, occurring most commonly in persons with diabetes
.It is common to get them on the scalp.Especially with the frequent use of the hat that you mention,it might cause aggravation due to warm and moist environment.
Folliculitis usually responds to antiseptic washes, warm compresses, and topical antibiotics
Appropriate oral antibiotic therapy is required for patients who have immunosuppression
or moderate-to-severe folliculitis.
I would suggest you seeing a doctor, as these are very recurrent and keep persisting ,unless proper therapy is instituted.However please take care not to touch or burst them at all!
Hope this helps..