I am very new to this stack of technology so please try to bear with me.
I’m on Windows and my workplace has some repos that I need to run on docker container. It is really old as they use PHP 5.6 with debian image from whenever they started working on it. The first two commands in dockerfile contains the following:
FROM php:5.6-apache
RUN apt update
When I try to build, it can’t reach the images as they don’t exist anymore:
0.294 Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
0.297 Ign:2 http://deb.debian.org/debian stretch InRelease
0.315 Err:3 http://security.debian.org/debian-security stretch/updates Release
0.315 404 Not Found [IP: 151.101.130.132 80]
0.325 Ign:4 http://deb.debian.org/debian stretch-updates InRelease
0.352 Err:5 http://deb.debian.org/debian stretch Release
0.352 404 Not Found [IP: 146.75.74.132 80]
I tried using FROM debian:buster
before RUN apt update
but then it fails because I assume the dependencies are not supported, which shows the error as such:
=> ERROR [REDACTED stage-1 4/17] RUN docker-php-ext-install mbstring opcache pdo_mysql mysqli s 0.3s
------
> [REDACTED stage-1 4/17] RUN docker-php-ext-install mbstring opcache pdo_mysql mysqli simplexml xsl zip gd:
0.331 /bin/sh: 1: docker-php-ext-install: not found
------
failed to solve: process "/bin/sh -c docker-php-ext-install mbstring opcache pdo_mysql mysqli simplexml xsl zip gd" did not complete successfully: exit code: 127
Can someone please help me on how to run PHP5.6 in the container with the current dockerfile I have linked here.
2
Answers
You would need to either update you Debian distribution, or update the
sources.list
with the new locations for old package repositories. There is this tutorial which is not official documentation but can still help you.However I strongly recommend you NOT doing this. Active Support and Security Support for PHP 5.6 resp. ended the 19th of January, 2017 and the 31th of December, 2018. I would strongly recommend you to gradually update your application to supported PHP versions. This would also allow you to "pull" more recent Linux distributions that are shipped with the latest PHP versions in Docker images. Therefore you won’t have to edit the
sources.list
or update you distribution manually, which can be quite tricky and cause compatibility issues with your applications.Using
FROM debian:buster
won’t work like you said asdocker-php-ext-install
is an executable that only exists in the PHP Docker image.You need to use the archive mirror, because the directory of an EOL release will be moved to archive when a release reach EOL. e,g:
The security repository should be remove from your sources.
Debian wiki: debian-archive