【发布时间】:2021-01-26 02:33:18
【问题描述】:
我正在尝试在 ubuntu 20.04 上将 xdebug 3 与 docker 一起使用,但没有成功, xdebug 没有进入中断点,我已经搜索了所有内容,没有答案解决我的问题,应该是 docker 主机的问题,因为相同的配置在 windows 中是正确的,我不知道我还能尝试什么解决问题, 我想帮助了解我做错了什么,下面是我的配置。
我的 docker-compose 文件
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
我的 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
如果有人可以合作,我很感激,谢谢
【问题讨论】:
-
在您的 docker-compose 文件中,您映射了错误的端口。应该是
- "9003:9003"
标签: php docker ubuntu docker-compose vscode-debugger