Comments (10)
I notice the absence of a port when creating the container. I believe that xdebug2 uses port 9000 while xdebug3 uses 9003 so you might need to export that port for the debugger to connect.
from php.
I notice the absence of a port when creating the container. I believe that xdebug2 uses port 9000 while xdebug3 uses 9003 so you might need to export that port for the debugger to connect.
When I add -p 9003:9003
to the container create
command, it will cause port 9003 to be used, not allowing me to run the PHP debugger in VSCode which gives me the error that port 9003 is in use.
Is there another way to open a port but not use the port?
from php.
However this will force the container to use the host network
It shouldn't be necessary to set --network=host
in order to use the host.containers.internal
address.
from php.
However this will force the container to use the host network
It shouldn't be necessary to set
--network=host
in order to use thehost.containers.internal
address.
For me it is on Manjaro using the latest version of podman
from php.
Strange - it looks like this was added way back in podman 3.2 (https://github.com/containers/podman/releases/tag/v3.2.0)
Podman now adds an entry to /etc/hosts, host.containers.internal, pointing to the current gateway (which, for root containers, is usually a bridge interface on the host system) (containers/podman#5651).
I have used it for xdebug many times without setting --network=host - Maybe the manjaro package is doing something to disable this feature?
It should be easy to test, just check /etc/hosts in any container (containers/podman#10878 (comment)):
$ podman run docker.io/library/alpine grep host.containers.internal /etc/hosts
192.168.86.56 host.containers.internal host.docker.internal
Running podman 4.9.4 on fedora
from php.
This is what I get when I run these commands in the terminal...
$ podman run docker.io/library/alpine grep host.containers.internal /etc/hosts
10.0.2.15 host.containers.internal host.docker.internal
$ ifconfig
enp0s3:
inet 10.0.2.15
$ podman --version
podman version 4.8.2
I wish I can try this on Debian :( but the latest version of Podman available for Debian based distros is 3.4.4
I did try to reproduce this on Fedora inside a VirtualBox VM, but I keep getting an SELinux popup when I run the container and the PHP script in the container which maybe preventing me from using the debugger. I never used Fedora before.
from php.
UPDATE:
I disabled SELinux in the Fedora VM by changing SELINUX=disabled
in the /etc/selinux/config file. I was able to get the debugger to work with SELinux disabled, however I still needed to have --network=host
as a flag when creating the container for VSCode debugging to work.
from php.
UPDATE:
When I create the container without using the --network=host
flag but set xdebug.client_host
setting in the php.ini to my device local IP address xdebug.client_host = 172.16.1.123
, it will work. I do not know why it does not work when set to "host.containers.internal"
or xdebug://gateway
Why is this the case?
from php.
What is the default network mode podman is using? If you omit the --network option entirely when you create your container and then run:
$ podman container inspect my-container | grep NetworkMode
What is the output?
from php.
$ podman container inspect my-container | grep NetworkMode
"NetworkMode": "slirp4netns",
from php.
Related Issues (20)
- Add Support for shmop HOT 1
- Remove archive php.tar.xz from final images HOT 1
- php8.2.15 removed ftp extension HOT 13
- Connectivity issue after php:8.0-fpm HOT 13
- Error during build prod.Dockerfile
- Changes on httpd without reload HOT 6
- Configuring PHP directives without custom images HOT 5
- Can't install php7.4-sybase package on php:7.4-apache-bullseye HOT 3
- iconv ASCII//TRANSLIT invalid argument HOT 2
- Php
- Add mlocati/docker-php-extension-installer to base image HOT 1
- Update apache 2.4.57-2 to 2.4.58-1 HOT 4
- ext-sockets won't compile in official Docker image 8.3.3-fpm-alpine3.19 HOT 2
- Interpreter does not resolve builtin functions when provide nonexistente file to opcache.preload option HOT 1
- Can't rename the php.ini-development HOT 2
- Bundled curl version is causing segfault HOT 1
- Update libxml in php:7.3-apache to version 2.9.14 HOT 1
- Bbb HOT 1
- I've got this error saying missing file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php.