我试图在Ubuntu容器上安装Postgresql-12,但是它给出了以下错误。
正在读取状态信息...E:无法找到包PostgreSQL-12E:无法找到package postgresql 12
看起来Ubuntu18容器不支持PostgreSQL版本12。有什么方法可以在Ubuntu18.04容器上安装postgresl版本12吗?任何帮助都会得到认可。下面给出了停靠程序文件代码片段。
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发布于 2021-02-23 01:32:25
您似乎使用了错误的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是Ubuntu12.04的代号(几年前就已经结束了),但是您的Dockerfile使用了更新的Ubuntu18.04。Ubuntu18.04的代号是bionic。
编辑:,由于连接到Dockerfile中给出的密钥服务器有问题,我查看了PostgreSQL网站并通过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行)。
https://stackoverflow.com/questions/66325204
复制相似问题