Devil's advocate says...
... containers don't need to be smart if it scans in and out and the shelves have weight sensors. If it knows that you have taken a 1pt carton out, it got 595g lighter, and when you put it back in it only gets 205g heavier again, then it knows you've used 390ml milk and that you have 178ml left.
But I think it's more likely that your supermarket could tell you than that your fridge could: "Hey, John, you used to buy 2pts milk a day and one box of Cap'n Crunch a week but you haven't bought much milk recently, do you need more?"
This approach is still fallible, of course: "No thank you, Tesco, now that my sons are teenagers I just have milk piped from the local dairy. And when we run out of cereal I have to call Eddie Stobarts"