在Docker中安装XDebug [英] Installing XDebug in Docker
本文介绍了在Docker中安装XDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Docker容器中安装XDebug,但是出现以下错误:
I'm trying to install the XDebug in a Docker container, but I'm getting the following error:
E: Unable to locate package php-xdebug
这是我的Dockerfile:
This is my Dockerfile:
FROM php:7.0-apache
RUN a2enmod rewrite
RUN docker-php-ext-install pdo pdo_mysql
RUN apt-get install php-xdebug -y
COPY php.ini /usr/local/etc/php/
COPY . /var/www/html/
当我在计算机上运行同一命令时,XDebug正在安装而没有任何错误:
When I'm running the same command in my computer, the XDebug is getting installed without any error:
apt-get install php-xdebug
有人知道问题可能在哪里吗?
Does anyone know where the problem might be?
请先谢谢您!
推荐答案
我通过在Docker文件中添加以下行来解决了这个问题:
I solved this by adding the following lines into my Docker file:
FROM php:7.0-apache
RUN a2enmod rewrite
RUN docker-php-ext-install pdo pdo_mysql
RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
COPY php.ini /usr/local/etc/php/
COPY . /var/www/html/
这篇关于在Docker中安装XDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文