Take a look to Dockerfile
You have our example configuration: docker-php-ext-xdebug.ini
environment:
PHP_IDE_CONFIG: 'serverName=host.docker.internal' ## to work with xdebug in docker requests
XDEBUG_TRIGGER: ## to work with xdebug in docker cli scripts
extra_hosts:
- "host.docker.internal:host-gateway" ## to be able to reach the container from our IDE
- To configure the PhpStorm with the xdebug go to edit configurations
2. Click on add configuration and PHP Remote Debug
3. We have to give a name to this config, I suggest your name project and add the ide key and configure a new server. IDE key must be the same we configure in xdebug.ini
4. We most to give a name to the server, set the host, the port used to communicate and the directory mapping
5. After save the changes you can activate the debug mode and run a script