If you trap it put down a lot of sleeping bags. If you die and can't respawn right next to it, and you respawn outside of render distance, it'll get out of the cage and fly away.