The creature in the container does not take damage. From the rules on Areas of Effect:
If no unblocked straight line extends from the
point of origin to a location within the area of effect, that
location isn’t included in the spell’s area.
Since there's both a backpack and a container between the creature and the spell's point of origin, there's no unblocked straight line, and the creature won't be affected.
You've stated that objects are unaffected, but for other readers who might be thinking "Doesn't the container break?" - technically, no. Each spell states what it does or does not affect. For example, fireball:
Each creature
in a 20-foot-radius sphere centered on that point must
make a Dexterity saving throw.
[...]
It ignites flammable
objects in the area that aren’t being worn or carried.
So a fireball will affect creatures within its area, and objects that aren't being worn or carried. The container is an object, but it's being carried, so it's fine.
Going through each and every spell to check whether they affect objects is left as an exercise for the reader, but very few spells affect objects, and even less affect objects being carried by a creature.