FROM php:8.0-apache
WORKDIR /var/www/html
RUN a2enmod rewrite
ENV APACHE_DOCUMENT_ROOT /var/www/html/web
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN pecl install xdebug && docker-php-ext-enable xdebug
ADD ./xdebug.ini /usr/local/etc/php/conf.d
EXPOSE 80
EXPOSE 9003
[xdebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
xdebug.mode=develop,coverage,debug,profile
xdebug.idekey=docker
xdebug.start_with_request=yes
xdebug.log=/dev/stdout
xdebug.log_level=0
xdebug.client_port=9003
xdebug.remote_port=9003
xdebug.client_host=127.0.0.1
docker build -t yii2 .
docker run -dit -p 80:80 -p 9003:9003 --mount type=bind,src=E:/DEV/fixcom/yii2/public-html,dst=/var/www/html --name yii2_cont yii2
xdebug.client_host=127.0.0.1
docker inspect <container_id>
или задать явно в момент запуска контейнера.