Rice is a wonderful food to carry aboard. It is filling, easy to cook, and adds substance to any meal. In Puerto Rico, where I grew up, rice was a staple food at meals. Everything seemed to be based around rice and beans (beans are also easy to store).
Rice is works very well on a sailboat because it stores well and is compact. A few handfuls can make a meal once cooked. It can be bought in large bags which can be tucked away in cabinets for a long time and it doesn't go bad. This means that rice can be used as an emergency food supply. You can plan the provisions needed for the whole trip, and then throw in a 10 pounds bag of rice for insurance against starvation.
These large bags of rice can be difficult to dispense small amounts of rice from and they are difficult to reseal. This does lead to the problem of rice spilling from the bag and getting all over the locker. To avoid this, when I open a bag of rice, I will dispense it into separate resealable storage containers.
I like to use the small cereal containers from IKEA. They are small, easy to store in the galley cabinets, and easy to dispense and seal the rice. Being made of plastic, they are also less likely to break while in storage. A 5 pound bag of rice can be evenly distributed between 3 small IKEA containers.
To dispense the rice, simply flip up the lid and pour out what you need. When you are finished, the lid snaps back into place, avoiding accidental openings in the cabinet. The silicone seal will also help prevent pest infestations in the container. If something did find its way inside, it will only affect one of the multiple containers, rather than affecting the whole store of rice (the same principle of not keeping "all your eggs in one basket").
Give rice a try, it makes great meals and is easy to keep aboard for extended periods of time!