When using a give command to give yourself a chest with a container component the contents of that component are not set to the chest when placed.
/give @s minecraft:chest[minecraft:container=[{slot:0,item:{id:"minecraft:dirt"}}]]
gives a chest that won't have a dirt block inside it when placed
/give @s minecraft:shulker_box[minecraft:container=[{slot:0,item:{id:"minecraft:dirt"}}]]
gives a shulker box that will have a dirt block when placed
Other components can be used across many items as long as it's applicable
Comments 3
This doesn't allow for explicit or inline item definitions for the container though, you must create a loot table for the items that you want in your chest item. This makes what you can have as the item contents for the chest less dynamic as you have to point to a static loot table.
Thank you for your report!
After consideration, the issue is being closed as Invalid.
You have posted a feature request or a suggestion. This site is for bug reports only.
For suggestions, please visit The official Minecraft feedback site or visit the Minecraft Feedback Discord server.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
'container' is specifically used for shulker boxes as noted in the changelog:
container_loot should be used instead for chests.