apt-get install -f 不解决依赖关系
apt-get install -f does not resolve dependencies
我在 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图片只是官方图片(在docker文件中):
FROM ubuntu:trusty
整个docker文件(仅供参考)
FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <helmi@tuxuri.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
# enable all the repositories
RUN apt-get -y install software-properties-common
RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
RUN apt-get -y update
RUN apt-get -y install 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
RUN 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 -f install libgdal1h
#RUN apt-get -y install 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 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图片只是官方图片(在docker文件中):
FROM ubuntu:trusty
整个docker文件(仅供参考)
FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <helmi@tuxuri.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
# enable all the repositories
RUN apt-get -y install software-properties-common
RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
RUN apt-get -y update
RUN apt-get -y install 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
RUN 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 -f install libgdal1h
#RUN apt-get -y install 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