Hi, thanks for the guide. I am using VSCode from WSL2 with Docker installed in WSL2. But this setup will not work for me.
Do you have any suggestsions?
Experience in Software and DevOps Engineering, with an in-depth interest in technology. Outside of work, I find joy in savoring a cup of coffee, music, and spending time with dogs and guinea pigs.
A few days I ago I had to sovle the same problem again, because I hat to re-setup my local develpment. I was really happy to find my old setup here :-D
On Windows with WSL2 and Docker I had to add the "hostname" property to the launch.json with the value "0.0.0.0". "hostname": "0.0.0.0"
Also, I didn't have to specify my IP address on the xdebug.ini host field. I used the host.docker.internal, xdebug.client_host='host.docker.internal' and xdebug.discover_client_host=0
I am a full-stack developer and love coding and tooling. At my work, I am often the person who is developing and setting up dev and production environments.
Hey really appreciated this guide, it helped me a lot to create my favorite dev env for laravel. I wrote about it here dev.to/snakepy/my-favorite-laravel...
Firstly thanks for the post and also the helpful comment. I also faced similar issue where I created a drupal site with docker and using docker desktop in windows wsl.
NOTE: where 192.168.65.2 is the host.docker.internal IP. For me the hostname didn't work, but by adding the IP directly worked. I've checked the IP from "/etc/hosts" file inside my docker container.
thx. one thing to mentions, mayby useful
i use linux, and on another guide a added
extra_hosts:
- host.docker.internal:host-gateway
to my docker-compose file.
eveything started working as you described only after deleting this options.
and one more clarification
"pathMappings": {
"/app/": "${workspaceFolder}/symfony/"
},
left side(key) is route to app folder inside container, and righthand route to files on my machine, where IDE is opened.
Hi, thanks for the guide. I am using VSCode from WSL2 with Docker installed in WSL2. But this setup will not work for me.
Do you have any suggestsions?
Thanks in advance
Hi @apmyp1990, what problems are you facing?
Do you have any logs that you can share?
I solved the problem - this line was missing:
Kudos for posting the answer to your problem after you'd solved it.
A few days I ago I had to sovle the same problem again, because I hat to re-setup my local develpment. I was really happy to find my old setup here :-D
On Windows with WSL2 and Docker I had to add the "hostname" property to the launch.json with the value "0.0.0.0".
"hostname": "0.0.0.0"Also, I didn't have to specify my IP address on the xdebug.ini host field. I used the host.docker.internal,
xdebug.client_host='host.docker.internal'andxdebug.discover_client_host=0Thanks a lot for your great article
Hey really appreciated this guide, it helped me a lot to create my favorite dev env for laravel. I wrote about it here dev.to/snakepy/my-favorite-laravel...
I'd appreciate any improvement suggestions.
Firstly thanks for the post and also the helpful comment. I also faced similar issue where I created a drupal site with docker and using docker desktop in windows wsl.
This is what worked for me.
xdebug.ini
xdebug.mode=debugxdebug.start_with_request=yes
xdebug.discover_client_host=true
xdebug.client_host=192.168.65.2
xdebug.output_dir=/tmp/xdebug
xdebug.log=/tmp/xdebug/xdebug-drupalapp.log
xdebug.idekey=docker
NOTE: where 192.168.65.2 is the host.docker.internal IP. For me the hostname didn't work, but by adding the IP directly worked. I've checked the IP from "/etc/hosts" file inside my docker container.
Updated my launch.json file inside vscode.
"configurations": ....
...
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"hostname": "0.0.0.0",
"log": true,
"pathMappings": {
"/opt/drupal": "${workspaceFolder}/drupal-app"
},
},
Start the debugging by clicking RUN&DEBUG or crlt+shift+D.
check the site with adding query parameter XDEBUG_SESSION_START=docker
where 'docker' is same as xdebug.idekey inside xdebug.ini
like:
http://drupalapp.localhost/blogs?XDEBUG_SESSION_START=dockerIt worked !!
I want to run with docker container inside php how to setup
thx. one thing to mentions, mayby useful
i use linux, and on another guide a added
extra_hosts:
- host.docker.internal:host-gateway
to my docker-compose file.
eveything started working as you described only after deleting this options.
and one more clarification
"pathMappings": {
"/app/": "${workspaceFolder}/symfony/"
},
left side(key) is route to app folder inside container, and righthand route to files on my machine, where IDE is opened.
thanks!