如何使用 php:7.2.21-fpm 构建 docker 容器从本地 debian 镜像安装 debian 软件包?

How to make docker container built with php:7.2.21-fpm install debian packages from local debian mirror?

我有一个从 https://hub.docker.com/_/php

php:7.2.21-fpm 构建的 docker 容器

在安装过程中,正在从 cdn-fastly.deb.debian 下载所需的包。org/debian

而且下载速度在200kbytes/sec左右

是否可以使映像从本地镜像获取 debian 软件包? https://www.debian.org/mirror/list

安装时下载速度可达10Mbytes/sec

澄清:我在白俄罗斯,我的本地系统从 BY 镜像下载更新。

php:7.2.21-fpm 根据 here

使用 debian:buster-slim

因此,对于几乎每个 debian 发行版,您都可以通过覆盖 sources.list 来更改镜像,引导我们 Belarus Mirror:

# Update apt-get source
RUN echo \
    deb http://ftp.by.debian.org/debian/ buster main contrib non-free
    deb-src http://ftp.by.debian.org/debian/ buster main contrib non-free
    > /etc/apt/sources.list