Why does cocoa not fall out of an inverted jar? Here is a picture of me pouring some cocoa powder into a container.

I have turned the jar of cocoa powder upside down, yet the cocoa powder doesn't just fall out. I have to shake it a little for the powder to fall out. Then the powder stops falling out and I have to shake it some more. (Arguably a video would be more useful to demonstrate this than an image, but I think you guys know what I'm talking about)
Can somebody explain this phenomenon?
Gravity is obviously acting on the powder, so I would expect it to just fall out of the jar with little resistance. Why does it get "stuck"? Is it just so compact that the powder particles push against each other, and the particles on the "edges" push against the glass container, so I have to dislodge them by shaking?
 A: There are at least two effects at work here, as suggested in the comments above. 
First, there are weak forces of adhesion between the tiny particles of the cocoa powder which are made stronger by the presence of moisture. Even small amounts of humidity in the air will strengthen those adhesive forces enough to convert a container of powder into a chunk of cocoa cement, which is why you have to keep the powder in a sealed container away from moisture.
Second, there is an effect by which sharp and irregular granules can compact themselves together and (unexpectedly) support shear stresses when sideways constraint is present. This is easiest to observe with a bottle full of coarsely-crushed salt; any individual chunk of which could easily fall out through the bottle's neck. When you fill the bottle with the stuff and then invert it, it is possible for a group of salt chunks to form a "logjam" in the neck of the bottle and block the flow- but only when the diameter of the neck opening approaches perhaps 10X the average chunk size. Designers of machinery intended to convey and dispense granular materials have to know this rule for any given material, to ensure that blockages of this sort cannot occur.   
