dockerdebian-stretch

Docker build slow since Debian Archives


First of all, I'm quite a noob when it comes to Docker, so it might be something really easy I'm missing. I'm trying to get a PHP 7.1 image to work on Docker using docker-compose. It used to build in like 5 to 10 minutes, but now it can take hours since I have to use the archives (according to this answer). My stripped Dockerfile looks like this:

FROM php:7.1.24-apache-stretch

RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list

RUN apt-get -y update --fix-missing && \
    apt-get --no-install-recommends install -y apt-utils

Afterwards I run docker-compose build --no-cache [CONTAINER NAME].

I tried removing the update command, but then it can't find the packages I need (including the apt-utils package).

Does anyone know in what direction I need to take a look to fix the slow build? Am I doing anything wrong here? I've looked all over the internet, but it just seems I can't find the right answer.


Solution

  • Apparently something was corrupted. Thanks to @Rick Rackow for pointing me in the right direction.

    First I removed every container and all images with docker prune -a. Afterwards I updated Docker, and it magically started working. So not really a concise answer as to why it happened, but hopefully someone else will be helped by this when necessary.