Remote debugging fails on PhpStorm

This is Xdebug configuration on a docker container:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=172.18.0.5
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
xdebug.connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_autostart=0
#xdebug.remote_mode=req

This is the validation process from PhpStorm which is successful:

enter image description here

Toggle listening for incoming connections also is done successfully but when trying to register IDE from DBGp Proxy -> Register IDE I see an error:

Xdebug proxy: Cannot connect to xdebug proxy on ‘localhost:9000’

This is DBGp configuration:

enter image description here

Currently docker container does not expose port 9000 otherwise PhpStorm will complain 9000 is busy. What could be wrong here?

Source: StackOverflow