It is a bit of a distance from the City Center. Although I did meet a couple that took public transit to the dock, but it I think they must of had a walk. Stockholm is an amazing and beautiful city, do make sure to check out the Vasa Museum.
No need to book a tour unless you really want to know all about Estonia. What you need to see is compact and walkable in a couple of hours. Not advised for unhealthy people, there is a bit of a hill to climb if you want to see the City. This is the city to shop in the Baltics, most reasonable prices can be found here. There are many places to eat in the city core. Our ship provided transportation to the edge of the city. Bigger ships did not offer this service and passengers had to walk 15 minutes through a shipyard & warehouse area.
If your ship comes to this port I hope you have more than one day here. Our ship was docked for 3 days and with a independent tour operator we did 3 days of non stop sites in SPB, from 9-16 each day. And with tose days I feel we only scratched the surface of SPB. YOU DO NOT NEED A VISA if you book with a tour operator, but you can not walk off the ship and do your own thing in SPB w/o a visa. Unless you know the cyrillic alphabet you will be awestruck of how foreign the place is.
Wow we arrived in Copenhagen the day it reached 37C / 98F the hottest temp it had recorded in 37 years. They city was not built for that type of heat, but it is a beautiful city. Take a canal tour, there are 2 types a hop on hop off which takes 2.5 hours, and a direct loop that takes about an hour. A great way to see the many parts of the city. Be ready to spend a lot of money, as Copenhagen is expensive. Example our lunch consisted of 2 open face sandwiches, 2 beers, 2 snaps and a bowl of ice cream w/ fruit was $80. Not trying to scare you, just beware for your budget's sake. Make sure you get a danish hot dog, form many of the carts around the city they are delicious and inexpensive.