Modify your docker-compose.yml file below.
You want to open port 9000 and not bind it. Also upgrade your xdebug ini to the ip of your host (mac), not ip docker.
I also added how you can mount the xdebug file from your Mac directly to your docker so you can update it on the fly. This allows you more control, as you may have to update your ip based on the transition from Wi-Fi to Wi-Fi. Xdebug.remote_host = ip should be your mac local network. Just remember, if you use apache to execute service apache2 restart or the corresponding command to restart your server anytime you change ip.
version: '2' services: php: image: <image name> ports: - 80:80 expose: - "9000" volumes: - .:/var/www/html - ./php.ini:/usr/local/etc/php/conf.d/php.inivolumes: - ./20-xdebug.ini:/etc/php/7.1/cli/conf.d/20-xdebug.ini //obviously you would change this to your correct paths - ./20-xdebug.ini:/etc/php/7.1/apache2/conf.d/20-xdebug.ini //obviously you would change this to your correct paths # 20-xdebug.ini, this is how mine is setup. zend_extension = /usr/lib/php/20160303/xdebug.so xdebug.remote_enable=1 xdebug.remote_host=192.168.0.4 // Make sure you use your host (mac) local ip, not the ip of docker. xdebug.remote_port=9000 xdebug.idekey = PHPSTORM xdebug.remote_handler = dbgp xdebug.remote_autostart = 1 xdebug.remote_log = /var/log/xdebug.log
user3247016
source share