我在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中):
FROM ubuntu:trusty
整个dockerfile(仅供参考)
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
答案 0 :(得分:1)
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