This really depends on what you want to do. If you're only interested in sightseeing in the old town, then a few days for visiting Dubrovnik should be enough. If you want to explore more of the city and the surrounding area, then 5-7 days would be ideal. And if you're looking to visit some of the other destinations close to Dubrovnik, then a week-long trip is perfect.