I applied Mexico visa for business at one time. When I was waiting inside, I was asked to help translating a dialogue for a Chinese who is going on a cruise and applying for Mexico visa. The Mexican consulate officer said that the itinerary from the cruise would show where people stay each night. And if they don't stay overnight in Mexico, they won't need the visa. And when you have a valid US visa to re-enter US at the end of the trip, you won't have any problem to obtain the Mexico visa.
Contact the cruise company to obtain an itinerary first. Have a good trip!