0

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.

Jordy
  • 320
  • 2
  • 15
  • 1
    This is a connection issue more likely than anything else. I just built this: ` real 0m14.362s` – Rick Rackow May 02 '23 at 08:46
  • Thanks for your answer @RickRackow! Did it use cache by any chance? I just tried again and it's already taking over 2 minutes for just this part: `http://archive.debian.org/debian-security stretch/updates InRelease [59.1 kB]`. My internet speed is quite good, about 350 mbit. Tried it in the office as well as at home. And when I `ping archive.debian.org`, it shows no packet loss and the average latency is 28ms. Do you maybe have any other tips on how to diagnose this? – Jordy May 02 '23 at 08:57
  • 1
    i cleared everything before with `docker system prune -a` so no caching. That's on a 1G connection. Just to try you can add -o Acquire::ForceIPv4=true when running apt-get. – Rick Rackow May 02 '23 at 09:03
  • Thanks again! I tried it with the `-o Acquire::ForceIPv4=true`, but it still takes the same time unfortunately. – Jordy May 02 '23 at 09:09

1 Answers1

1

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.

Jordy
  • 320
  • 2
  • 15
  • 1
    This did the trick for me as well! Was troubleshooting a build locally that was running quickly otherwise, but forgot to set a secret so it failed. After I set it the whole build went from an expected 2 minute total build time to running 10+ minutes (while still indicating progress) before I killed it, pruned, and installed the latest point release. Thanks Rick and Jordy! – John Kelly III Jun 14 '23 at 17:28