Ubuntu 18.04 docker 图片的 PostgreSQL 12 安装问题
PostgreSQL 12 installion problem with Ubuntu 18.04 docker image
我试图在 Ubuntu 容器上安装 Postgresql-12,但出现以下错误。
Reading state information...
E: Unable to locate package postgresql-12
E: Unable to locate package postgresql-client-12
Ubuntu18 容器似乎不支持 PostgreSQL 版本 12。
有什么办法可以在 Ubuntu 18.04 容器上安装 postgresl 版本 12?
任何帮助表示赞赏。 docker 文件代码片段如下。
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
您似乎使用了错误的 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 行)。
我试图在 Ubuntu 容器上安装 Postgresql-12,但出现以下错误。
Reading state information... E: Unable to locate package postgresql-12 E: Unable to locate package postgresql-client-12
Ubuntu18 容器似乎不支持 PostgreSQL 版本 12。 有什么办法可以在 Ubuntu 18.04 容器上安装 postgresl 版本 12? 任何帮助表示赞赏。 docker 文件代码片段如下。
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
您似乎使用了错误的 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 行)。