Skip to content

Instantly share code, notes, and snippets.

@guibranco
Last active March 7, 2025 17:27
Show Gist options
  • Save guibranco/9342f83c5e51b7ec85d9046c652d1074 to your computer and use it in GitHub Desktop.
Save guibranco/9342f83c5e51b7ec85d9046c652d1074 to your computer and use it in GitHub Desktop.
Docker file for PHP 5.6 with Apache, MySQL extension, GD2 and Apache mod_rewrite enabled
FROM php:5.6-apache
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
-e 's|security.debian.org|archive.debian.org/|g' \
-e '/stretch-updates/d' /etc/apt/sources.list
RUN apt-get update
RUN apt-get install --yes --force-yes cron g++ gettext libicu-dev openssl libc-client-dev libkrb5-dev libxml2-dev libfreetype6-dev libgd-dev libmcrypt-dev bzip2 libbz2-dev libtidy-dev libcurl4-openssl-dev libz-dev libmemcached-dev libxslt-dev
RUN a2enmod rewrite
RUN docker-php-ext-install mysql
RUN docker-php-ext-enable mysql
RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr
RUN docker-php-ext-install gd
COPY ./ /var/www/html/
@Martzy303
Copy link

W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.2.132 80]
E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

For me it fails when running apt-get update

@guibranco
Copy link
Author

@Martzy303 fixed! Try again please 😃

@samansupriadi
Copy link

thank you

@telmodias
Copy link

Thank you!

@Dalidos
Copy link

Dalidos commented Nov 8, 2024

Thank you !

@umermajeed07
Copy link

umermajeed07 commented Nov 21, 2024

`
=> ERROR [web 2/6] RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libmcrypt-dev && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install gd && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-install mcrypt 4.8s

[web 2/6] RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libmcrypt-dev && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install gd && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-install mcrypt:
0.474 Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
0.549 Ign:2 http://deb.debian.org/debian stretch InRelease
0.590 Ign:3 http://security.debian.org/debian-security stretch/updates Release
0.686 Ign:4 http://deb.debian.org/debian stretch-updates InRelease
0.722 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
0.816 Ign:6 http://deb.debian.org/debian stretch Release
0.869 Ign:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.947 Ign:8 http://deb.debian.org/debian stretch-updates Release
1.006 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
1.078 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
1.139 Ign:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
1.228 Ign:10 http://deb.debian.org/debian stretch/main all Packages
1.272 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
1.376 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
1.408 Ign:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
1.504 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
1.575 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
1.631 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
1.711 Ign:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
1.779 Ign:10 http://deb.debian.org/debian stretch/main all Packages
1.844 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
1.927 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
1.976 Ign:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
2.054 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
2.110 Ign:5 http://security.debian.org/debian-security stretch/updates/main all Packages
2.182 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
2.244 Err:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
2.244 404 Not Found [IP: 151.101.130.132 80]
2.330 Ign:10 http://deb.debian.org/debian stretch/main all Packages
2.487 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
2.616 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
2.747 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
2.895 Ign:10 http://deb.debian.org/debian stretch/main all Packages
3.045 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
3.181 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
3.311 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
3.460 Ign:10 http://deb.debian.org/debian stretch/main all Packages
3.613 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
3.740 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
3.869 Err:9 http://deb.debian.org/debian stretch/main amd64 Packages
3.869 404 Not Found [IP: 151.101.130.132 80]
4.018 Ign:10 http://deb.debian.org/debian stretch/main all Packages
4.167 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
4.296 Err:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
4.296 404 Not Found [IP: 151.101.130.132 80]
4.302 Reading package lists...
4.316 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
4.316 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
4.316 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
4.316 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80]
4.316 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80]
4.316 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80]
4.316 E: Some index files failed to download. They have been ignored, or old ones used instead.
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libmcrypt-dev && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install gd && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-install mcrypt" did not complete successfully: exit code: 100
`

Its gives this for docker compose build

@suthipongbb13
Copy link

suthipongbb13 commented Feb 24, 2025

I modified these two lines to make them work:
RUN docker-php-ext-install mysqli pdo_mysql mysql
RUN docker-php-ext-enable mysqli pdo_mysql mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment