fengkx / postgres-docker

Self-use postgres docker image with chinese fulltext search and somes extra extensions
https://hub.docker.com/r/fengkx/postgres
7 stars 3 forks source link

How to migrate from the official postgres docker image? #1

Closed einverne closed 3 years ago

einverne commented 3 years ago

I've already used the official postgres:lastest image for quite a while, then I found the problem with the Chinese search, I mapped the postgresql data to a named volume.

  db:
    image: postgres:latest
    container_name: postgres
    restart: always
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - miniflux-db:/var/lib/postgresql/data

So I have a question, can I just replace the postgres image with this image. Or I should export all the data and then start up a new container with the image then reimport all data?

fengkx commented 3 years ago

You can choose either way. But If you don't have any DBMS maintain knowledge, reimport all data is a better choice. If you want to keep your original data file, You may need to change the postgresql.conf file in the volume like this script do.