Why Object2D jump out collision?

Player (square/blue object) is controlled by arrows. It moves along the X and Y. Blue and red object have a collider and a rigid body. I want to slide the player inside a red object with him slide the (up, down, right) and if player inside , it has always been in the middle of the red object. See video with problem.

Can you help me?