Large container ships or aircraft carriers can stay at dock and just have all entrances sealed off. They are strong, less likely to get hit by waves, and retain safety without having to be stuck in the middle of the ocean.
The most important factor, like any base, is having the right amount of survivors with you. That can maintain the ship and keep it well defended. Having a larger survivor base also protects you from pirates.
WARNING: With multiple passages, cargo crates and rooms, any undead could sneak inside before all entrances is secured. Search the ship throughly with caution before calling it a day and making it a base.
Some container ships captain and crews might use the zombie apocalypse for a reason to get their families, relatives, and/or random survivors to board the ship and sail away. There will be a lot of these ships in the ocean. Large ships can have many lifeboats, just in case the ship becomes overrun and a quick getaway is needed. Aside from that, aircraft carriers are designed, as the name suggests, to carry aircraft, which can function as transport.