When I run the docker-compose build command, the Dockerfile does not build and I get the following error:
[app 2/21] RUN apt-get update && apt-get install -y zlib1g-dev libzip-dev libonig-dev libfreetype6-dev libjpeg62-turbo-dev libmagickwand-dev libicu-dev libgmp-dev re2c libmhash-dev libmcrypt-dev curl libcurl3 libcurl3-dev cron supervisor file msmtp wget ssh git mariadb-client iputils-ping net-tools dnsutils libmemcached-dev libzmq3-dev logrotate --no-install-recommends:
0.978 Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
1.056 Ign:2 http://deb.debian.org/debian stretch InRelease
1.282 Ign:3 http://security.debian.org/debian-security stretch/updates Release
...
5.750 Err:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
5.750 404 Not Found [IP: 151.101.66.132 80]
...
12.85 Err:9 http://deb.debian.org/debian stretch/main amd64 Packages
12.85 404 Not Found
...
How can I solve this problem and build the Dockerfile successfully? What could be causing the 404 error when installing packages via apt-get?
Here is my Dockerfile:
FROM php:5.6-fpm
RUN apt-get update && apt-get install -y
zlib1g-dev
libzip-dev
libonig-dev
libfreetype6-dev
libjpeg62-turbo-dev
libmagickwand-dev
libicu-dev
libgmp-dev
re2c
libmhash-dev
libmcrypt-dev
curl
libcurl3
libcurl3-dev
cron
supervisor
file
msmtp
wget
ssh
git
mariadb-client
iputils-ping
net-tools
dnsutils
libmemcached-dev
libzmq3-dev
logrotate
--no-install-recommends
RUN docker-php-ext-install mysql curl
RUN pecl install memcached-2.2.0
&& docker-php-ext-enable memcached
RUN pecl install memcache-2.2.7
&& docker-php-ext-enable memcache
RUN pecl install xdebug-2.5.5
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
&& docker-php-ext-enable xdebug
RUN pecl install imagick
&& docker-php-ext-enable imagick
--with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install zip intl mbstring pdo_mysql exif
&& docker-php-ext-configure gd
&& docker-php-ext-install gd
&& docker-php-ext-install zip
RUN pecl install zmq-beta
&& docker-php-ext-enable zmq
#RUN ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/ \
&& docker-php-ext-configure gmp \
&& docker-php-ext-install gmp
#RUN BEFORE_PWD=$(pwd) \
&& mkdir -p /opt/xdebug \
&& cd /opt/xdebug \
&& curl -k -L https://github.com/xdebug/xdebug/archive/XDEBUG_2_5_5.tar.gz | tar zx \
&& cd xdebug-XDEBUG_2_5_5 \
&& phpize \
&& ./configure --enable-xdebug \
&& make clean \
&& sed -i 's/-O2/-O0/g' Makefile \
&& make \
# && make test \
&& make install \
&& cd "${BEFORE_PWD}" \
&& rm -r /opt/xdebug
COPY ./install-composer.sh /
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./crontab /etc/cron.d/cron
COPY ./php.ini /usr/local/etc/php/
COPY ./www.conf /usr/local/etc/php/
COPY ./msmtprc /etc/
COPY ./app_logrotate /etc/logrotate.d/app
RUN chmod 0644 /etc/logrotate.d/app
RUN apt-get purge -y g++
&& apt-get autoremove -y
&& rm -r /var/lib/apt/lists/*
&& rm -rf /tmp/*
&& sh /install-composer.sh
&& rm /install-composer.sh
RUN usermod -u 1000 www-data
RUN crontab /etc/cron.d/cron
VOLUME /root/.composer
WORKDIR /app
EXPOSE 9000
CMD ["php-fpm"]
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
Full Docker-compose error:
[+] Running 52/18
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
- db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣿] 37.02MB/64.27MB Pulling 588.9s
[+] Running 52/18 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
- db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣿] 37.02MB/64.27MB Pulling 589.8s
[+] Running 52/18 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
- db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣿] 38.09MB/64.27MB Pulling 591.9s
[+] Running 52/18 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
- db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣿] 38.09MB/64.27MB Pulling 592.9s
[+] Running 52/18 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
- db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣿] 38.09MB/64.27MB Pulling 593.9s
[+] Running 54/18 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled
✔ nginx 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 575.3s
✔ db 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 665.8s
✔ nginx-proxy 13 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 278.2s
✔ memcached 5 layers [⣿⣿⣿⣿⣿] 0B/0B Pulled 242.8s
✔ tg_web 13 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 11.8s
[+] Building 24.0s (7/26) docker:default
=> [app internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.97kB 0.0s
=> [app internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [app internal] load metadata for docker.io/library/php:5.6-fpm 10.1s
=> [app auth] library/php:pull token for registry-1.docker.io 0.0s
=> [app internal] load build context 0.0s
=> => transferring context: 217B 0.0s
=> CACHED [app 1/21] FROM docker.io/library/php:5.6-fpm@sha256:4f070f1b7b93cc5ab364839b79a5b26f38d5f89461f7bc0c 0.0s
=> ERROR [app 2/21] RUN apt-get update && apt-get install -y zlib1g-dev libzip-dev lib 13.8s
------
> [app 2/21] RUN apt-get update && apt-get install -y zlib1g-dev libzip-dev libonig-dev libfreetype6-dev libjpeg62-turbo-dev libmagickwand-dev libicu-dev libgmp-dev re2c libmhash-dev libmcrypt-dev curl libcurl3 libcurl3-dev cron supervisor file msmtp wget ssh git mariadb-client iputils-ping net-tools dnsutils libmemcached-dev libzmq3-dev logrotate --no-install-recommends:
0.978 Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
1.056 Ign:2 http://deb.debian.org/debian stretch InRelease
1.282 Ign:3 http://security.debian.org/debian-security stretch/updates Release
1.368 Ign:4 http://deb.debian.org/debian stretch-updates InRelease
1.607 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
1.690 Ign:6 http://deb.debian.org/debian stretch Release
1.935 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
2.093 Ign:8 http://deb.debian.org/debian stretch-updates Release
2.326 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
2.466 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
2.645 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
2.813 Ign:10 http://deb.debian.org/debian stretch/main all Packages
2.978 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
3.132 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
3.288 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
3.452 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
3.617 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
3.968 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
4.022 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
4.300 Ign:10 http://deb.debian.org/debian stretch/main all Packages
4.333 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
4.617 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
5.451 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
5.750 Err:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
5.750 404 Not Found [IP: 151.101.66.132 80]
6.053 Ign:7 http://security.debian.org/debian-security stretch/updates/main all Packages
6.658 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
6.953 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
7.247 Ign:10 http://deb.debian.org/debian stretch/main all Packages
7.625 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
7.949 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
8.245 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
9.334 Ign:10 http://deb.debian.org/debian stretch/main all Packages
9.692 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
10.09 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
10.41 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
10.79 Ign:10 http://deb.debian.org/debian stretch/main all Packages
11.22 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
11.55 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
12.85 Err:9 http://deb.debian.org/debian stretch/main amd64 Packages
12.85 404 Not Found
13.14 Ign:10 http://deb.debian.org/debian stretch/main all Packages
13.45 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
13.78 Err:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
13.78 404 Not Found
13.80 Reading package lists...
13.81 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
13.81 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
13.81 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
13.81 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.66.132 80]
13.81 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages 404 Not Found
13.81 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages 404 Not Found
13.81 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 zlib1g-dev libzip-dev
libonig-dev libfreetype6-dev libjpeg62-turbo-dev libmagickwand-dev libicu-dev libgmp-dev \t re2c \t libmhash-dev \t libmcrypt-dev \t curl \t libcurl3 \t libcurl3-dev \t cron \t supervisor \t file msmtp wget ssh git mariadb-client iputils-ping net-tools dnsutils libmemcached-dev libzmq3-dev logrotate --no-install-recommends" did not complete successfully: exit code: 100
Answer "apt-get update failed to fetch debian amd64 packages while building dockerfile from maven:3.5.2-jdk-8" didn't solve my problem.
Based on the answers, I added this to the Dockerfile:
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian stretch main" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.debian.org/debian stretch main" >> /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
It solved my problem
– BloodyCayman Sep 14 '23 at 05:31