docker安装xdebug的时候有时候链接不到pecl.PHP.net。这时候如果能设置全局代理链接到当然好,但是有时候链接不到需要在dockerfile里面添加一句加代理的语句
pear config-set http_proxy http://192.168.0.118:1080
最终结果
#####################################
# xDebug:
#####################################
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
Install the xdebug extension
pear config-set http_proxy http://192.168.0.118:1080 && \
pecl install xdebug && \
docker-<a href="/tag/PHP/" target="_blank" class="keywords">PHP</a>-ext-enable xdebug \
;fi
Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /usr/local/etc/PHP/conf.d/xdebug.ini