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. If the ship stays at dock with the surrounding port clear and well-defended, a larger base may be established (possibly part or whole of the port) with supplies provided by one or more ships as well as in the port itself.
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.