tianon / docker-postgres-upgrade

a PoC for using "pg_upgrade" inside Docker -- learn from it, adapt it for your needs; don't expect it to work as-is!
https://hub.docker.com/r/tianon/postgres-upgrade/
MIT License
1.09k stars 116 forks source link

Missing support for Postgres 14 #39

Closed LouisMT closed 3 years ago

LouisMT commented 3 years ago

Postgres 14 has been released a few days ago and I would like to try out this tool to upgrade my Docker databases this time! 😄 Will keep an eye on this repository.

Thanks!

thedanbob commented 3 years ago

If you don't want to wait, just grab the docker-upgrade script from any of the folders (don't forget to make it executable!) and build this Dockerfile:

FROM postgres:14-bullseye

RUN sed -i 's/$/ 13/' /etc/apt/sources.list.d/pgdg.list

RUN apt-get update && apt-get install -y --no-install-recommends \
                postgresql-13=13.4-4.pgdg110+1 \
        && rm -rf /var/lib/apt/lists/*

ENV PGBINOLD /usr/lib/postgresql/13/bin
ENV PGBINNEW /usr/lib/postgresql/14/bin

ENV PGDATAOLD /var/lib/postgresql/13/data
ENV PGDATANEW /var/lib/postgresql/14/data

RUN mkdir -p "$PGDATAOLD" "$PGDATANEW" \
        && chown -R postgres:postgres /var/lib/postgresql

WORKDIR /var/lib/postgresql

COPY docker-upgrade /usr/local/bin/

ENTRYPOINT ["docker-upgrade"]

# recommended: --link
CMD ["pg_upgrade"]