Ok, finally I have found a solution.
Actually, I can choose any ip address to end up my tunnel. So, instead of 127.0.0.2 I need to end up this tunnel on address 172.17.0.1 - this address is output of this command on host:
ip addr show docker0
After that I can simply connect from my PHP-container:
$db = new PDO("mysql:host=172.17.0.1;port=13306", "user", "pass");