xdebug 3 not working in ubuntu 20.04 with docker

  docker, docker-compose, php, ubuntu, vscode-debugger

I’m trying to use xdebug 3 with docker on ubuntu 20.04, but I’m not getting success,
xdebug does not enter the interruption point, I already searched for everything and no answer solved my problem, it would be something about the docker host, because the same configuration is the right one in windows, I don’t know what else I can try to solve the problem,
I would like a help to understand what I’m doing wrong, below is my configuration.

My docker-compose file

version: '3.7'

networks:
  supervisao:

services:
  nginx:
    image: nginx:stable-alpine
    container_name: supervisao-web
    ports:
      - "80:80"
    volumes:
      - .:/var/www/html/
      - ./.docker/web/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
      - mysql
    networks:
      - supervisao
  mysql:
    image: mysql:latest
    container_name: supervisao-db
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    tty: true
    ports:
      - "3306:3306"
    volumes:
      - ./.docker/mysql/:/var/lib/mysql
    environment:
      MYSQL_DATABASE: supervisao
      MYSQL_USER: user
      MYSQL_PASSWORD: pass
      MYSQL_ROOT_PASSWORD: pass
      SERVICES_TAGS: dev
      SERVICES_NAME: mysql
    networks:
      - supervisao
  php:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: supervisao-php
    volumes:
      - .:/var/www/html/
      - ./.docker/php/docker-xdebug.ini:/usr/local/etc/php/conf.d/php-docker.ini
    ports:
      - "9000:9000"
    networks:
     - supervisao
  redis:
    image: redis:latest
    volumes:
      - ./.docker/redis:/data
    ports:
      - 6379:6379
    networks:
      - supervisao

my xdebug.ini

# File: docker-xdebug.ini
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.discover_client_host=1
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003
xdebug.log = /var/www/html/xdebug.log

I appreciate if someone can collaborate, thank you

Source: Docker Questions

LEAVE A COMMENT