在 postgres:11.10 docker 图片中安装 procps

Installing procps in postgres:11.10 docker image

我正在使用来自 dockerhub 的 postgres:11.10 图像,我希望在 运行 图像之前在图像上安装 'procps' 包。为此,我在 Docker 文件中添加了 RUN apt-get install procps

但是,在构建图像时我得到以下信息:

E: Unable to locate package procps
ERROR: The command '/bin/sh -c apt-get install procps' returned a non-zero code: 100

我的问题是,在执行 RUN apt-get install procps 时,Docker 如何确定在搜索软件包时参考哪些 debian 存储库? docker 主机上的安装决定了要查询的 debian 存储库还是由基本映像中配置的存储库决定?

您需要更新 apt 包源,然后安装 procps 包。

Dockerfile

FROM postgres:11.10
RUN apt-get update \
 && apt-get install -y procps