You don’t glue the case into the rocket. The case is a reusable part that you reload, so it needs to be removable so that you can clean it, reload it, and use it in multiple rockets.
As
@OverTheTop mentioned, you use a retainer to hold the motor in place. If you’ve only flown Estes black powder motors, then you might not know about thrust rings. Estes motors are a smooth cardboard tube that is the same diameter the full length of the motor. If you don’t install a motor block in the motor mount, the motor will just shoot through the rocket. But for composite motors, you don’t install a motor block, because the motors can be different lengths.
Instead of using motor blocks in the tube, the motor cases for composite motors generally have a thrust ring on the case when they are assembled. The thrust ring is at the nozzle end of the motor, and it’s a wider diameter than the rest of the case, and it can’t fit through the motor tube. So it keeps the motor from flying through the rocket.
Generally the rocket has a retainer that keeps the motor from falling out of the rocket. I like screw-on retainers. After you assemble the motor inside the case, you slide the case into the rocket so that the thrust ring is firm against the aft end of the motor mount tube. Then you screw the retainer on over the thrust ring to hold it in place.
If you are new to composite motors, I would suggest starting off with Aerotech single-use motors and hold off on getting started with reloads. If you already have rockets built for Estes 24mm D and E motors, you could try a single-use Aerotech E20. It will fit in the motor tube, even with the motor block installed, and it will work with an Estes clip retainer or Estes 24mm screw-on retainer. If you have rockets built for Estes 29mm E and F motors, you could try Aerotech F20, F23, F27, F42, F67, or G74 motors. All of these are fun motors, but be aware, your rocket will go higher than they would on an Estes motor.