If you dock in the industrial area of the port (the case for most large cruise ships), it's not recommended to walk around in the harbor. It is too crowded and dangerous because of the many trucks, cranes, container trailers, etc. Moreover, you are 3-4 kilometers from the city center. You would lose too much valuable time.
If you dock close to the cruise terminal at Porto Mercantile, you can walk to the city center. From the pier, there are signs to the city and the nearest bus stop. Opposite the Fortezza Vecchia, one of the old forts, there is an exit gate of the port area. From there it is a 20 minute walk to the center.
TIP: The N° 5 and N° 8R bus stop that you will see at the exit of the port are not interesting as the timetables don't match with the ones of the cruise lines. Also the next stops are outside the city center.