Error Installing postgresql-client-9.6 on Docker

When trying to install postgresql-client-9.6 on some debian based Docker images you may run into the following issue: 

The following packages have unmet dependencies: 
postgresql-client-9.6 : Depends: libpq5 (>= 9.6.6) but 9.4.15-0+deb8u1 is to be installed 
E: Unable to correct problems, you have held broken packages.

This has to do with an upstream issue with the particular version of the image that you are using. CircleCI builds its Docker images from the official languages repositories on Docker Hub. This means that ultimately a long term fix for these sorts of issues should be done upstream in the images themselves. 

In order to work around this issue, you can use the approach recommended by Postgresql. For Debian Jessie based images (which are the current common base image) something like this should work for your builds: 

- run:
    name: Install PostgreSQL Client
    command: |

        echo "deb jessie-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list

        wget --quiet -O - | sudo apt-key add -

        sudo apt-get update

        sudo apt-get install postgresql-client-9.6
Was this article helpful?
3 out of 12 found this helpful


1 comment
  • Hi Lev,


    Comment actions Permalink

Please sign in to leave a comment.