I am trying to debug laravel code on visual studio code ide using xdebug. I am using docker container that works as server.
But I am getting this error when try to debug:
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 192.168.99.100:9000).
Here is my vscode launch.json
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Docker: Attach to Node",
"port": 9000,
"address": "192.168.99.100",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/var/www",
"protocol": "inspector",
"restart": true
}
]
Here is docker-compose.yml
app:
build:
context: ./
dockerfile: .docker/app.dockerfile
args:
- INSTALL_XDEBUG=true
working_dir: /var/www
volumes:
- ./:/var/www
environment:
- "DB_PORT=33061"
- "DB_HOST=192.168.99.100"
- XDEBUG_CONFIG=remote_host=192.168.99.100 remote_port=9000 remote_connect_back=0
Here is my app.dockerfile
FROM php:7.1-fpm
RUN docker-php-ext-install pdo && docker-php-ext-install pdo_mysql
#####################################
# xDebug:
#####################################
ARG INSTALL_XDEBUG=true
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension
pecl install xdebug && \
docker-php-ext-enable xdebug \
;fi
# Copy xdebug configration for remote debugging
COPY .docker/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
#####################################
# ZipArchive:
#####################################
ARG INSTALL_ZIP_ARCHIVE=false
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension
docker-php-ext-install zip \
;fi
# RUN apt-get update && apt-get install -y \
# freetds-bin \
# freetds-dev \
# freetds-common \
# libct4 \
# && docker-php-ext-install pdo_dblib
# pdo_dblib
RUN apt-get update && apt-get install -y freetds-dev
RUN docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu
RUN docker-php-ext-install pdo_dblib
RUN sed -i "s|\[sqlsrv\]|\[sqlsrv\]\nhost = 172.18.250.57\nport =1435\nclient charset=UTF-8\ntds version = 8.0|g" /etc/freetds/freetds.conf
RUN usermod -u 1000 www-data
WORKDIR /var/www
CMD ["php-fpm"]
EXPOSE 9000
EXPOSE 9001
I think vscode cant connect to remote xdebug with 9000 port. But when check to app docker image xdebug is working properly. Maybe vscode needs some more configuration. But I couldn't solve this issue.
Please help.
Thanks
via Chebli Mohamed
I highly recommend to use Codelobster IDE for it
RépondreSupprimer