How do cloves break down plastic?
Most of the odor of cloves comes from volatile molecules, especially eugenol, found in the cloves.  Eugenol is a water-immiscible, oily liquid at ambient temperatures.

Plastic with resin identifiction code #6 is polystyrene. 

Polystyrene is not compatible with most organic solvents, because it tends to be softened, swelled, or even completely dissolved by them.

Thus I suspect that the problem is that oil in the cloves is attacking the plastic that you use.  You could avoid the problem (mostly) by using a plastic with resin code #2 or #5 (i.e. high-density polyethylene or polypropylene) instead of #6.  But, you are probably right that glass would be better than any plastic for storing your cloves.