Tested on: docker php:5.6.40-fpm
If you need Xdebug version compatibile with older php versions and you can’t do it by PECL.
Download sources to .docker
dir e.g. .docker/xdebug-2.5.5.tgz
In Dockerfile:
# Xdebug install from sources
RUN echo \
&& mkdir /usr/local/lib/xdebug
COPY .docker/xdebug-2.5.5.tgz /usr/local/lib/xdebug/xdebug-2.5.5.tgz
RUN echo \
&& cd /usr/local/lib/xdebug/ && tar zxvf xdebug-2.5.5.tgz \
&& cd /usr/local/lib/xdebug/xdebug-2.5.5 \
&& phpize \
&& ./configure --enable-xdebug \
&& make \
&& make install