Ubuntu apt get install-f不解析依赖项

Ubuntu apt get install-f不解析依赖项,ubuntu,docker,apt,Ubuntu,Docker,Apt,我在Ubuntu docker容器上 docker文件中的一行 RUN apt-get -y -f install libgdal1h 导致 Step 14 : RUN apt-get -y -f install libgdal1h ---> Running in 10b9065694f0 Reading package lists... Building dependency tree... Reading state information... Some packages coul

我在Ubuntu docker容器上

docker文件中的一行

RUN apt-get -y -f install libgdal1h
导致

Step 14 : RUN apt-get -y -f install libgdal1h
---> Running in 10b9065694f0
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:



The following packages have unmet dependencies:
libgdal1h : Depends: libarmadillo4 but it is not going to be installed
Depends: libhdf5-7
Depends: libnetcdfc7 but it is not going to be installed
Ubuntu映像只是官方映像(在dockerfile中):

整个dockerfile(仅供参考)

来自ubuntu:trusty的

维修员赫尔米·易卜拉欣
运行echo“debhttp://archive.ubuntu.com/ubuntu trusty main universe“>/etc/apt/sources.list
#启用所有存储库
运行apt get-y安装软件属性公共
运行添加apt存储库“deb”http://archive.ubuntu.com/ubuntu      $(lsb_发行版-sc)主宇宙受限多重宇宙“
运行apt get-y更新
运行apt get-y安装wget
运行wget--安静--不检查证书-O-https://www.postgresql.org/media/keys/ACCC4CF8.asc |apt密钥添加-
运行echo“debhttp://apt.postgresql.org/pub/repos/apt/ trusty pgdg main“>>/etc/apt/sources.list
运行apt get-y更新
运行apt get-y升级
运行locale gen--不清除en_US.UTF-8
环境LC_ALL en_US.UTF-8
运行更新语言环境LANG=en_US.UTF-8
运行apt get-y-f安装libgdal1h
#运行apt get-y安装postgresql-9.3 postgresql-contrib-9.3 postgresql-9.3-postgis-2.1 postgis

Dockerfile中的这一行可能是导致问题的原因:

RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
您在这里仅用一行替换文件
/etc/apt/sources.list
的内容。由于缺少这些行,apt get无法安装所需的依赖项

如果将该行替换为以下内容,则生成工作正常:

RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" >> /etc/apt/sources.list

作为旁注,我不知道为什么要从头开始重新创建
/etc/apt/sources.list
文件。
ubuntu:trusty
图像中提供的一个已经包含了ubuntu.com上的默认值。您可以这样简化Dockerfile:

FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <helmi@tuxuri.com>

RUN apt-get update && apt-get -y install software-properties-common wget
RUN wget --quiet --no-check-certificate -O -     https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg    main" >> /etc/apt/sources.list
RUN apt-get -y update && apt-get -y upgrade
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

RUN apt-get -y install libgdal1h postgresql-9.3 postgresql-contrib-9.3 postgresql-9.3-postgis-2.1 postgis
来自ubuntu:trusty的

维修员赫尔米·易卜拉欣
运行apt-get-update&&apt-get-y安装软件属性公共wget
运行wget--安静--不检查证书-O-https://www.postgresql.org/media/keys/ACCC4CF8.asc |apt密钥添加-
运行echo“debhttp://apt.postgresql.org/pub/repos/apt/ trusty pgdg main“>>/etc/apt/sources.list
运行apt get-y更新和apt get-y升级
运行locale gen--不清除en_US.UTF-8
环境LC_ALL en_US.UTF-8
运行更新语言环境LANG=en_US.UTF-8
运行apt get-y安装libgdal1h-postgresql-9.3-postgresql-contrib-9.3-postgresql-9.3-postgis-2.1-postgis

删除Dockerfile开头的
/etc/apt/sources.list的内容是否有原因?这可能就是为什么
apt get
无法解析依赖项的原因。堆栈溢出用于编程问题。在超级用户上问这个问题可能更好。
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" >> /etc/apt/sources.list
FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <helmi@tuxuri.com>

RUN apt-get update && apt-get -y install software-properties-common wget
RUN wget --quiet --no-check-certificate -O -     https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg    main" >> /etc/apt/sources.list
RUN apt-get -y update && apt-get -y upgrade
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

RUN apt-get -y install libgdal1h postgresql-9.3 postgresql-contrib-9.3 postgresql-9.3-postgis-2.1 postgis