Kane Blueriver
Kane Blueriver

Reputation: 4268

Cannot get postgresql-9.3-postgis-2.1 on Ubuntu 14.04.1 Docker container

I tried to install postgresql-9.3-postgis-2.1 or postgresql-9.1-postgis-2.1 for a cloned app, but I can only get postgresql-9.4-postgis-2.1 on my Ubuntu docker image which is build from python:2.7 image.

I looked into the image and found it's on a Ubuntu 14.04.1 image. I tries to install postgis on my Xubuntu 14.04.2 VM, everything is OK.

How could I get the installation works OK?

Dockerfile is pretty easy:

FROM python:2.7
RUN mkdir /workspace
RUN mkdir /data
WORKDIR /workspace
RUN apt-get update
RUN apt-get install postgresql postgresql-common postgresql-9.3-postgis-2.1

Error code is very normal too:

E: Unable to locate package postgresql-9.3-postgis-2.1
E: Couldn't find any package by regex 'postgresql-9.3-postgis-2.1'

Upvotes: 1

Views: 1142

Answers (2)

Kane Blueriver
Kane Blueriver

Reputation: 4268

Thanks for everyone who tried to help me! Though I finally fix this myself, there is nothing wrong with the Dockerfile which is pretty simple, but the image I chose is not a typical Ubuntu image, the docker office use buildpack-deps:jessie instead of ubuntu:14.04 image: https://github.com/docker-library/python/blob/master/2.7/Dockerfile

It caused different behavior in docker and Ubuntu VM.

Finally, I build a Python image from Ubuntu:12.04 and fixed this issue.

Upvotes: 0

Peter Tillemans
Peter Tillemans

Reputation: 35341

Please provide more information, like the dockerfile and the errors you get.

From your comment it appears you load the python libraries before the postgresql libraries. I assume that your python app needs postgresql access and that it uses one of the python wrappers around the postgresql C libraries.

If that is the case then install the postgresql libraries before installing the python libraries, and do not forget to add the -dev libraries.

What I do in such a case is to make a minimal docker image, start a root shell in the container and do the install manually, take notes and use them to update the docker file. Alternatively you can run

$ docker exec -t -i bash -i

to get a shell in the container and try out what needs to be done.

Upvotes: 0

Related Questions