Issue
I am on Ubuntu docker container
one line in docker file
RUN apt-get -y -f install libgdal1h
results in
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 image is just official image (in dockerfile):
FROM ubuntu:trusty
the whole dockerfile (just for reference)
FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <[email protected]>
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
Solution
This line in the Dockerfile is probably causing the problem:
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
You are here replacing the content of the file /etc/apt/sources.list
by only one line. Then apt-get is unable to install the required dependencies because of these missing lines.
If you replace the line by the following, the build is working fine:
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" >> /etc/apt/sources.list
As a side note, I'm not sure why you are recreating the /etc/apt/sources.list
file from scratch. The one provided in the ubuntu:trusty
image already contains the default ones from ubuntu.com. You could simplify your Dockerfile like this:
FROM ubuntu:trusty
MAINTAINER Helmi Ibrahim <[email protected]>
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
Answered By - haradwaith