wodby / docker4php

Docker-based PHP stack
https://wodby.com/docker4php
MIT License
277 stars 44 forks source link

Php xdebug with traefik configuration #11

Open Smolevich opened 4 years ago

Smolevich commented 4 years ago

Codebase

Host OS

e.g. macOS Sierra macOS Mojave 10.14.6

Docker info output

Client:
 Debug Mode: false

Server:
 Containers: 27
  Running: 7
  Paused: 0
  Stopped: 20
 Images: 96
 Server Version: 19.03.4
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.952GiB
 Name: docker-desktop
 ID: 6YM6:LMGB:PQ2E:LXSH:24FU:CQ7H:5MVG:TIVF:H5UB:7DEI:72DW:BGT2
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 84
  Goroutines: 89
  System Time: 2019-10-29T14:35:25.592707274Z
  EventsListeners: 3
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

nginx: image: wodby/nginx container_name: "simple-service-2" environment: NGINX_SERVER_ROOT: /var/www/html/public NGINX_ERROR_LOG_LEVEL: debug NGINX_BACKEND_HOST: php NGINX_VHOST_PRESET: php NGINX_FASTCGI_INDEX: index.php labels:

networks: traefik_proxy: driver: bridge name: traefik_proxy


### Logs output

simple-service-3 | [29-Oct-2019 14:33:41] NOTICE: fpm is running, pid 1 simple-service-3 | [29-Oct-2019 14:33:41] NOTICE: ready to handle connections simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:33:45 +0000 "GET /index.php" 200 simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:33:47 +0000 "GET /index.php" 200 simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:55:16 +0000 "GET /index.php" 200 simple-service-3 | 172.21.0.5 - 29/Oct/2019:14:56:26 +0000 "GET /index.php" 200

php-xdebug.log:

[85] Log opened at 2019-10-29 14:56:26 [85] I: Connecting to configured address/port: host.docker.internal:9000. [85] I: Connected to client. :-) [85] -> <![CDATA[Xdebug]]><![CDATA[Derick Rethans]]><![CDATA[https://xdebug.org]]><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]> [85] [85] -> [85] [85] Log closed at 2019-10-29 14:56:26 [85]



But debug in Visual Studio Code doesn't work
csandanov commented 4 years ago

Check out https://github.com/wodby/docker4drupal/issues/345, and specifically comment https://github.com/wodby/docker4drupal/issues/345#issuecomment-452275197 might help you

VladSavitsky commented 4 years ago

Docker's containers are remote hosts for your IDE so check if you have correct mapping for your local paths to remote paths