首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >生成带有Postgres和安全更新的自定义码头映像时出错:“配置文件createcluster.conf可用”

生成带有Postgres和安全更新的自定义码头映像时出错:“配置文件createcluster.conf可用”
EN

Stack Overflow用户
提问于 2022-05-17 11:26:41
回答 1查看 455关注 0票数 0

我有一个基于postgres构建映像的Dockerfile,但它还安装了安全更新(这是为了确保映像具有最新的补丁,即使发布版本稍早)。

这是Dockerfile:

代码语言:javascript
运行
复制
FROM postgres:14.2

# apply security updates
RUN \
  apt-get update -qq && \
  apt-get upgrade -y && \
  rm -rf /var/lib/apt/lists/*

ENV PGDATA /var/lib/postgresql/data

# switch to lower-privileged user
USER 999

CMD ["postgres", "-c", "listen_addresses=*", "-c", "config_file=/etc/postgresql/postgresql.conf"]

现在,这个建筑破裂了:

代码语言:javascript
运行
复制
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be upgraded:
  libpq5 postgresql-14 postgresql-client-14 postgresql-client-common
  postgresql-common
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.9 MB of archives.
After this operation, 25.6 kB of additional disk space will be used.
Get:1 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 libpq5 amd64 14.3-1.pgdg110+1 [172 kB]
Get:2 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-common all 241.pgdg110+1 [230 kB]
Get:3 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-client-common all 241.pgdg110+1 [92.1 kB]
Get:4 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-client-14 amd64 14.3-1.pgdg110+1 [1,629 kB]
Get:5 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 postgresql-14 amd64 14.3-1.pgdg110+1 [15.8 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 17.9 MB in 1s (25.4 MB/s)
(Reading database ... 12100 files and directories currently installed.)
Preparing to unpack .../libpq5_14.3-1.pgdg110+1_amd64.deb ...
Unpacking libpq5:amd64 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Preparing to unpack .../postgresql-common_241.pgdg110+1_all.deb ...
Leaving 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (241.pgdg110+1) over (238.pgdg110+1) ...
Preparing to unpack .../postgresql-client-common_241.pgdg110+1_all.deb ...
Unpacking postgresql-client-common (241.pgdg110+1) over (238.pgdg110+1) ...
Preparing to unpack .../postgresql-client-14_14.3-1.pgdg110+1_amd64.deb ...
Unpacking postgresql-client-14 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Preparing to unpack .../postgresql-14_14.3-1.pgdg110+1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking postgresql-14 (14.3-1.pgdg110+1) over (14.2-1.pgdg110+1) ...
Setting up postgresql-client-common (241.pgdg110+1) ...
Setting up libpq5:amd64 (14.3-1.pgdg110+1) ...
Setting up postgresql-client-14 (14.3-1.pgdg110+1) ...
Setting up postgresql-common (241.pgdg110+1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring postgresql-common
-----------------------------
createcluster.conf: A new version (/tmp/postgresql-common.sK2jGD) of
configuration file /etc/postgresql-common/createcluster.conf is available, but
the version installed currently has been locally modified.
  1. install the package maintainer's version
  2. keep the local version currently installed
  3. show the differences between the versions
  4. show a side-by-side difference between the versions
  5. start a new shell to examine the situation
What do you want to do about modified configuration file createcluster.conf? 

我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-17 11:26:41

构建中断是因为它要求您做什么,而从脚本(或自动构建)来看,这是不可能的。

解决方案是允许apt非交互地配置安装。添加到您的Dockerfile中:

代码语言:javascript
运行
复制
ENV DEBIAN_FRONTEND=noninteractive

这样,自动选择将应用到包。这在大多数情况下都是可以的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72273216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档