I am trying to create a PHP, Postgresql development environment using docker by following this example: https://hk.saowen.com/a/67350ecfcbbe9dd8befa286a4257d5f91565a124ba3c7776c2b1c37f8b638df0. However, i am running into dependency issues when docker tries to install postgresql-client-9.6. The error that I receive is postgresql-client-9.6 : Depends: libpq5 (>= 9.6.11) but 9.6.10-0+deb9u1 is to be installed
The tutorial tries using php:7.0-apache and postgres:9.6. I have tried changing versions of both PHP and postgresql, but I am getting the same type of error with different dependcy numbers. It appears that libpq5 is out of date, and I don't know how to get a more recent version.
The Dockerfile that I am using is
FROM php:7.0-apache
RUN apt-get update && \
apt-get install -y libpq-dev gnupg && docker-php-ext-install pdo pdo_pgsql
RUN apt-get install -y wget
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.6" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -
RUN apt-get update
RUN apt-get install -y postgresql-client-9.6
COPY ./wait-for-postgres.sh wait-for-postgres.sh
RUN chmod +x wait-for-postgres.sh
COPY src/ /var/www/html
and the docker-compose.yml file is
version: '3'
volumes:
psql-data:
services:
php-app:
build: ./app
image: myapp
container_name: php-app
env_file:
- ./env
depends_on:
- postgres
command: ["./wait-for-postgres.sh", "apache2-foreground"]
ports:
- 80:80
networks:
app-env:
postgres:
image: postgres:9.6
container_name: postgres
env_file:
- ./env
volumes:
- ./postgres/script/:/docker-entrypoint-initdb.d
- psql-data:/var/lib/posgresql/data
networks:
app-env:
networks:
app-env:
This blog post describes the problem exactly, however the solution has not worked for me: https://support.circleci.com/hc/en-us/articles/360003953613-Error-Installing-postgresql-client-9-6-on-Docker. Thanks in advance for any advice offered.