Добрый вечер, дебаг на страницы работает, а в консолли выдает ошибку
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9008 (fallback through xdebug.client_host/xdebug.client_port) :-(?
docker-composer.yml
version: "3.7"
services:
app:
build:
args:
user: www
uid: 1000
context: ./
dockerfile: Dockerfile
image: laravel-image
container_name: laravel-app
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
db:
image: mysql:5.7
container_name: laravel-db
restart: unless-stopped
ports:
- "3367:3306"
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- ./mysql/my.cnf:/etc/mysql/my.cnf
- ./mysql/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/
networks:
- app-network
nginx:
image: nginx:alpine
container_name: laravel-nginx
restart: unless-stopped
ports:
- 8000:80
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
networks:
app-network:
driver: bridge
/php/local.ini
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
max_execution_time=300
[opcache]
opcache.enable_cli=1
[XDebug]
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.idekey = VSCODE
xdebug.mode = develop, debug
#my
xdebug.client_host=host.docker.internal
xdebug.client_port=9008
#my
FROM php:7.4-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip\
build-essential \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
jpegoptim optipng pngquant gifsicle \
vim \
libpq-dev \
libonig-dev \
libzip-dev && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install pdo_mysql mbstring zip exif pcntl gd soap
RUN pecl install xdebug-3.1.5 \
&& docker-php-ext-enable xdebug
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
COPY --chown=www:www . /var/www
RUN chown -R www:www /var/www/
RUN chown -R 1000:www /var/www/
RUN find /var/www/ -type f -exec chmod 644 {} \;
RUN find /var/www/ -type d -exec chmod 755 {} \;
RUN chgrp -R www /var/www/storage /var/www/bootstrap/cache
RUN chmod -R ug+rwx /var/www/storage /var/www/bootstrap/cache
RUN curl -sLS https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs
RUN npm install -g npm \
&& npm install -g sass
RUN apt-get update && apt-get install -y cron
COPY crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab\
&& crontab /etc/cron.d/crontab
RUN /usr/sbin/service cron start
# Set working directory
WORKDIR /var/www
USER $user
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug via Docker",
"type": "php",
"request": "launch",
"port": 9008,
"log": true,
"externalConsole": false,
"pathMappings": {
"/var/www": "${workspaceRoot}",
}
},
] }