Both "Andrea Doria" and "Duilio" went into drydock in the late 1930s for extensive modernizations; this work lasted until October and April 1940, respectively. By that time, Italy had entered World War II on the side of the Axis powers. The two ships joined the 5th Division based at Taranto. "Duilio" participated in a patrol intended to catch the British battleship and a convoy bound for Malta, but neither target was found. She and "Andrea Doria" were present during the British attack on Taranto on the night of 11/12 November 1940. A force of twenty-one Fairey Swordfish torpedo-bombers, launched from , attacked the ships moored in the harbor. "Andrea Doria" was undamaged in the raid, but "Duilio" was hit by a torpedo on her starboard side. She was grounded to prevent her from sinking in the harbor and temporary repairs were effected to allow her to travel to Genoa for permanent repairs, which began in January 1941. In February, she was attacked by the British Force H; several warships attempted to shell "Duilio" while she was in dock, but they scored no hits. Repair work lasted until May 1941, when she rejoined the fleet at Taranto.