After much pain I got this working with the following:
Dockerfile
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y \
&& apt-get install -y git curl \
&& pecl install xdebug \
&& rm -rf /tmp/pear \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)\n"
>> /usr/local/etc/php/conf.d/xdebug.ini
PHP.ini
xdebug.remote_host=10.254.254.254
xdebug.remote_autostart=1
xdebug.idekey = PHPSTORM
xdebug.default_enable = 0
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.profiler_enable = 1
sudo ifconfig en0 alias 10.254.254.254 255.255.255.0
I wrote up and recorded my workflow here: Debugging PHP apps
Hope this helps someone.