Pep Guardiola’s men saw plenty of possession but they had nothing to show after 90 minutes in Lviv as Bastian Schweinsteiger, Arjen Robben and Thomas Muller all wasted excellent chances.
However, the German champions’ task became much harder after Alonso was shown two yellow cards for challenges on Alex Teixeira either side of the break.
Bayern threw on Robert Lewandowski as they tried to find an important away goal but Mircea Lucescu’s side held on for a valuable draw to take to the Allianz Arena for the second leg next month.
Bayern pushed forward in the opening stages and it was Robben looking to have an immediate impact, finding Bastian Schweinsteiger in acres of space on the edge of the Shakhtar penalty area, but the German midfielder’s volley flashed wide.
Robben, who had scored eight goals in his last seven matches before tonight, was looking the most likely for the visitors and he should have done better after Alonso found him from a well worked free-kick, however, the Dutchman scuffed his shot.
There was not much coming back at Guardiola’s side and Robben broke forward again, playing Muller in behind the Shakhtar defence, but the German forward’s shot dribbled back into the six-yard box before being hooked clear by Oleksandr Kucher.
There was not much to do for Manuel Neuer as Shakhtar focused on defence but he was called into action midway through the first half, gathering Yaroslav Rakitskiy’s free-kick at the second time of asking.
It wasn’t long before Bayern’s dominance on the ball was restored with Franck Ribery and Mario Goetze linking up well, before the latter found Muller in space on the Shakhtar penalty spot, but again the Germany international was wasteful, firing over the bar.
After the break a similar pattern occurred with Bayern bossing possession and they thought they could have had a penalty when Alonso was brought down by Teixeira inside the area, but referee Alberto Undiano Mallenco remained unmoved.
Tempers were starting to flare as Douglas Costa’s elbow appeared to catch Ribery in the face, minutes after he kicked the ball at the Frenchman, but the Brazilian was only shown a yellow card.
The referee was called into action again in the 66th minute as Alonso, who was booked for a late challenge on Teixeira, brought down the same player again and Mallenco had no choice but to show the Spanish midfielder a second yellow card in his 100th Champions League appearance.
Shakhtar might have sensed an opportunity to claim an unlikely win but it was Bayern who made the first offensive change with Lewandowski replacing the ineffective Goetze with 15 minutes remaining.
But on what was a difficult night for the Bundesliga leaders as the hosts held on to deny Bayern an away goal and take a 0-0 draw into next month’s second leg.