Dumpster-diving is not a common practice, or common idea for that matter. Some people don’t even think of it as an option, for others it’s the first option.
Before describing the best way to do so, it’s important to understand why do it. Supermarkets, grocery stores and bakeries all throw away perfectly good food at the end of the day. Produce and bread especially. They throw away enough food to feed whole families every night. There’s no reason to not use this to your advantage when travelling and don’t have much money.
For the most part dumpster-diving is easy but time dependent. You can’t go hopping into a dumpster during the day looking for food. For one thing, there won’t be any food. The stores will throw away food that can’t be kept over a day only after closing time.
Secondly, it’s still a grey area in the terms of the law in different countries. Mostly in terms of trespassing though, not the act of taking the discarded food. With this in mind, just be careful to go at night — usually about 3 or 4 hours after closing and when it’s dark is a good time. Try to make sure no one is around as well and don’t go smashing the dumpster doors loudly.
One trouble that may arise is finding the dumpster. Some building complexes have the dumpster on the inside behind metal pull-down doors. Others are just setup in a way that you have no idea where back is. Trash-wiki is a good place to look for help on finding a dumpster for a store or finding a store that usually has good food
Something to keep in mind though, there are people who live on the streets and survive off this food, some of which may have a routine of going to certain dumpsters. This could lead to there being no food once you get to a dumpster, or some ruffled feathers if you go to a dumpster same time as someone else who usually goes there. Just be respectful and don’t take everything in it if you’re in a city.
Bakeries are some of the best places to get food after hours as almost all of them discard all their bread and sweets at the end of day. They won’t be fresh, but there will be usually a good amount and also are usually discarded in large trash bags. If you can get the bag and it isn’t ripped, than you are golden.
France is particularly good for this as it is illegal for french boulangeries (bakeries) to sell food older than day. So, at the end of the day there will be a large bounty.
Closed packages and closed type food (bananas are particularly safe, oranges etc.) are a great find, plastic packaged anything really is also fine. Check for holes and such while looking through the dumpster, anything with a hole toss it back in. If it’s in a tied garbage bag, it’s up to you. If its bread and the bag has no holes it’s fine.
It’s really just logic. The dumpster is dirty sure but so is the fruit before its washed. If its a closed package there’s no reason to see it any differently than still being on the shelf. This can be a savior to anyone with no money left, or looking to save some. Either way, it’s a good way to get free food and help stop food waste as well.