【问题标题】:PostgreSQL 12 installion problem with Ubuntu 18.04 docker imageUbuntu 18.04 docker 镜像的 PostgreSQL 12 安装问题
【发布时间】:2021-05-25 06:09:08
【问题描述】:

我试图在 Ubuntu 容器上安装 Postgresql-12,但它给出了以下错误。

正在读取状态信息... E: 找不到包 postgresql-12 E: 找不到包 postgresql-client-12

Ubuntu 18 容器似乎不支持 PostgreSQL 版本 12。 有什么方法可以在 Ubuntu 18.04 容器上安装 postgresl 版本 12? 任何帮助都会受到重视。 docker文件代码sn -p如下。

FROM ubuntu:18.04

RUN apt-get update && apt-get install -y gnupg dirmngr

RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8

RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common postgresql-12 postgresql-client-12

【问题讨论】:

    标签: postgresql docker dockerfile ubuntu-18.04


    【解决方案1】:

    您似乎使用了错误的 APT 软件包存储库。替换

    RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
    

    RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list
    

    然后再试一次。 precise 是 Ubuntu 12.04 的代号(几年前已经结束生命周期),但您的 Dockerfile 使用较新的 Ubuntu 18.04。 Ubuntu 18.04 的代号是bionic

    编辑: 由于我在连接到 Dockerfile 中给出的密钥服务器时遇到问题,我查看了PostgreSQL website 并通过wget 获取了密钥,如图所示。 Dockerfile 现在看起来像这样:

    FROM ubuntu:18.04
    RUN apt-get update && apt-get install -y gnupg dirmngr wget
    RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list
    RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
    RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common postgresql-12 postgresql-client-12
    

    值得注意的变化是安装wget(第2行)并使用它来获取密钥(第4行)。

    【讨论】:

      猜你喜欢
      • 2019-02-06
      • 1970-01-01
      • 2023-02-21
      • 1970-01-01
      • 1970-01-01
      • 2019-05-03
      • 2020-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多