Three things: First, the surface needs to be completely clean and dry. Second, it needs to be the right caulk- for shower and tub, 100% silicone. Third, lay the bead correctly- it looks like the previous bead was too wide and thin. There are some tools available to help, like this
Flimsy-Antelope4763 t1_ja582mp wrote
Reply to Caulk flaking off by mcsoma
Three things: First, the surface needs to be completely clean and dry. Second, it needs to be the right caulk- for shower and tub, 100% silicone. Third, lay the bead correctly- it looks like the previous bead was too wide and thin. There are some tools available to help, like this