The culprit for those stains is a bright red pigment in tomatoes called lycopene. This molecule is ‘hydrophobic’ (it repels water), and so are your plastic containers. Hydrophobic molecules come together in order to minimise their contact with water, so the pigment clings to the containers.
The hydrophobic nature of lycopene also means that it resists attempts to clean it with soapy water, and the high temperatures in a dishwasher can drive stains even deeper into your plastic containers. Try spraying the inside of your container with oil before use, which may help to protect the plastic by giving lycopene something else to cling to. Otherwise, reach for the bleach.
Dr Emma Davies is a science writer and editor with a PhD in food chemistry from the University of Leeds. She writes about all aspects of chemistry, from food and the environment to toxicology and regulatory science.