I pre pack measured portions into ziplock snack sized bags, then they all go into a big freezer type heavy duty zip lock that I put in my backpack that goes under the seat in front of me. I do not carry it in my carryon for fear of it busting open and the mess that would cause with clothes, shoes, etc.
Depending on the trip and how much I have, you can usually roll up the big zip lock full of portions and jam that into a shaker bottle and get the lid on, sometimes not, but it’s another way to compact things down.
I travel 75-100+ legs a year and I would say I get flagged about once a month on average...they typically give me a line about “looks like you have some organic matter in your backpack, can we take a look?” I tell them what it is and they usually do the “ok, that makes sense..” they swab and test it and I am on my way.