Problem starting an old dockerfile

Hello,
twelve or so years ago I moved some websites to docker / docker-compose to make it easier to archive them and (occasionally) restore and run them.

Today I tried to restore an old site but the dockerfile will no longer build.

I was hardly an expert when I created these files, but now I don’t even know where to start on this.

FROM php:5.6-fpm

LABEL maintainer="steve@myemail"
LABEL author="Steve Groom"

RUN apt-get -y update --fix-missing
RUN apt-get -y --force-yes install libxml2-dev libxslt-dev --fix-missing

# Install mysqli pdo_mysql mbstring xsl
# Create /usr/local/etc/php/conf.d/docker-php-ext-mbstring.ini
# Create /usr/local/etc/php/conf.d/docker-php-ext-xsl.ini
# Create /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
# Create /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini
RUN docker-php-ext-install mysqli pdo_mysql mbstring xsl


# From: https://github.com/helderco/docker-php/blob/master/template/bin/docker-php-pecl-install
# save the script next to Dockerfile and chmod +x.
# Install xdebug
# Create /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
COPY docker-php-pecl-install /usr/local/bin/
RUN docker-php-pecl-install xdebug-2.3.3


#RUN rm -rf /tmp/pear
RUN mkdir /usr/local/etc/php-fpm
RUN mkdir /usr/local/etc/php-fpm/conf.d


# Register the extensions
#RUN echo "extension=mbstring.so" > /usr/local/etc/php-fpm/php.ini \
#  && echo "extension=mysqli.so" > /usr/local/etc/php-fpm/php.ini \
#  && echo "extension=pdo_mysql.so" > /usr/local/etc/php-fpm/php.ini \
#  && echo "extension=xdebug.so" > /usr/local/etc/php-fpm/php.ini \
#  && echo "extension=xsl.so" > /usr/local/etc/php-fpm/php.ini \
# RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"' > /usr/local/etc/php/php.ini

RUN echo '; Comment - perhaps empty php.ini' > /usr/local/etc/php/php.ini


# Set up xdebug - customise remote_host for your phpstorm's host machine
# See http://theaveragedev.com/xdebug-and-php-fpm-configuration/
# https://easyengine.io/tutorials/php/xdebug-netbeans/

RUN echo \
  "[xdebug]\n" \
  "xdebug.remote_enable=1\n" \
  "xdebug.remote_handler=dbgp\n" \
  "xdebug.remote_port=9000\n" \
  "xdebug.idekey=PHPSTORM\n" \
  "xdebug.remote_host=192.168.1.71\n" \
  "xdebug.remote_connect_back=1\n" \
  "xdebug.user=www-data\n" \
  "xdebug.group=www-data" \
  >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini

#RUN echo '[xdebug]'                          > /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.remote_enable=1'          >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.remote_handler=dbgp'      >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.remote_port=9000'         >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.idekey=PHPSTORM'          >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.remote_host=192.168.1.71' >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.remote_connect_back=1'    >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.user=www-data'            >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini \
#  && echo 'xdebug.group=www-data\n'         >> /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
#

# Update options extensions to allow php-fpm to generate not only php but css, jpg etc.
# Activate xdebug.
RUN echo "\nsecurity.limit_extensions = FALSE" >> /usr/local/etc/php-fpm.conf \
 && echo "\ninclude=/usr/local/etc/php-fpm/conf.d/*" >> /usr/local/etc/php-fpm.conf

# Install modules
#RUN apt-get update && apt-get install -y \
#        libfreetype6-dev \
#        libjpeg62-turbo-dev \
#        libmcrypt-dev \
#        libpng12-dev \
#    && docker-php-ext-install iconv mcrypt \
#    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
#    && docker-php-ext-install gd

#RUN docker-php-ext-install mbstring

# Install XSL

#    && echo "xdebug.remote_connect_back=0" >>  /usr/local/etc/php-fpm/conf.d/xdebug.ini \
#    && echo "xdebug.remote_host=192.168.123.118" >>  /usr/local/etc/php-fpm/conf.d/xdebug.ini \

# 2020 02 12 php5-imagick not found 
## Adding imagemagick
##RUN apt-get update
#RUN apt-get install -y php5-imagick imagemagick libssl-dev
RUN apt-get update \
  && apt-get install -y imagemagick \
  && apt-get install -y libmagickwand-dev --no-install-recommends \
  && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick
RUN docker-php-ext-enable imagick
##RUN apt-get install -y
#RUN echo "extension=find /usr/lib/. -name imagick.so" > /usr/local/etc/php/php.ini
RUN echo "extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/imagick.so" > /usr/local/etc/php/php.ini

CMD ["php-fpm"]
#CMD ["bash"]

My intention is to get the old website running and then to use a scraper to create a static archive that can be more readily accessed (similar to the internet archive).

The apt-get commands give 404 not founds and then error 100.

There are three Dockerfiles in total - php, mysql and phpmyadmin that have the same sort of issues.

Is it still possible to run php 5.6 with Docker plus some extensions?

regards
Steve

Since the old PHP image is based on an old Linux distribution and the APT repositories are not available on the old URL. Replace the content of /etc/apt/sources.list with

deb http://archive.debian.org/debian stretch main

You can copy a file or add a RUN instruction before the first apt command:

RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
1 Like

You really want to use a 5 year old php image? You know how many bug and security fixes have been applied since then?

I think that is not the goal :slight_smile:

Thank you @rimelek ,
that has made my day. The docker images are now running on a Synology, I should be able to connect to the website once I figure out Synology DSM networking :smiley: