Example xdebug with docker docker exec xdebugdocker_php_1 php /var/www/html/public/index.php # or docker-compose exec php php /var/www/html/public/index.php Run this command on your mac first. Do this once and you are set up for life. sudo ifconfig lo0 alias 172.16.123.1