MIAMI -- Puerto Rico has imposed a rationing of basic supplies including water and baby formula as Hurricane Maria approaches as a Category 5 storm.

Officials said Monday that the rationing is necessary to ensure everyone has access to basic items such as batteries, milk, canned foods, flashlights and other supplies. It does not apply to gasoline or other fuels.

Shelves at many stores were emptying out quickly as people rushed to finalize hurricane preparations. Many posted desperate pleas on social media for help in finding certain items.

Get Breaking News Delivered to Your Inbox

Some stores were already imposing their own rationing measures and stressed that more merchandise was scheduled to arrive on Monday to replenish shelves, officials said.

The U.S. National Hurricane Center said Maria -- on a path that would take it near many of the islands already wrecked by Hurricane Irma and then on toward Puerto Rico and the Dominican Republic -- is an "extremely dangerous" storm with maximum sustained winds of 160 mph. It was centered about 15 miles east-southeast of Dominica -- or 40 miles east of Martinique -- and heading west-northwest at 9 mph late Monday afternoon.

This satellite image from the National Oceanic and Atmospheric Administration (NOAA) shows Hurricane Maria on Mon., Sept. 18, 2017. NOAA

Hurricane warnings were posted for the U.S. and British Virgin Islands, Guadeloupe, Dominica, St. Kitts, Nevis, Montserrat, Martinique and St. Lucia. A tropical storm warning was issued for Antigua and Barbuda, Saba, St. Eustatius, St. Maarten and Anguilla.

On Wednesday, Maria is expected to be near or over Puerto Rico, which was spared the full brunt of Hurricane Irma, although much of the island had its power knocked out. Nearly 70,000 people remain without power, and Gov. Ricardo Rossello on Monday warned of another widespread outage.

Forecasters said the storm would dump up to 18 inches of rain across Puerto Rico and whip the U.S. territory with heavy winds for 12 to 24 hours.

Officials said the Federal Emergency Management Agency was ready to bring drinking water and help restore power in Puerto Rico immediately after the storm.

Rossello said officials had prepared about 450 shelters with a capacity for nearly 68,000 people -- or even 125,000 in an emergency. Schools were cancelled for Monday and government employees would work only a half day.