更改Docker映像抛出:psycopg2.errors.UndefinedFile:无法访问文件“ $ libdir / postgis-3”错误

时间:2020-10-07 18:38:48

标签: django postgresql docker postgis

我正在运行带有已安装postgis的postgres数据库的dockerized django应用程序。我为此使用官方映像,并使用docker-compose进行构建,如下所示:

  postgres:
    container_name: postgres_postgis
    image: postgis/postgis
    volumes:
      - local_postgres_data:/var/lib/postgresql/data
      - local_postgres_data_backups:/backups
    env_file:
      - ./.envs/.local/.postgres

效果很好。现在,我尝试使用已安装了Postgis(https://hub.docker.com/r/timescale/timescaledb-postgis/)的官方时标​​图像来更改此图像。我正在像这样更改docker-compose文件:

  postgres:
    container_name: postgres_postgis_timescale
    image: timescale/timescaledb-postgis:latest-pg12
    volumes:
      - local_postgres_data:/var/lib/postgresql/data
      - local_postgres_data_backups:/backups
    env_file:
      - ./.envs/.local/.postgres

我的应用程序运行良好,但运行正常,但是当我尝试访问使用postgis的数据时,出现此错误:

django.db.utils.OperationalError: could not access file "$libdir/postgis-3": No such file or directory

因此,我进入数据库并尝试使用ALTER EXTENSION postgis UPDATE;升级扩展名,但得到extension "postgis" has no update path from version "3.0.1" to version "2.5.3",所以我想我是最新的。

我非常确定它已连接到此扩展程序,但不知道如何解决此问题...有人可以帮助我吗?

非常感谢!

编辑:这两个图像具有相同的扩展版本是很奇怪的:


          Name          | Version |   Schema   |                             Description                             
------------------------+---------+------------+---------------------------------------------------------------------
 fuzzystrmatch          | 1.1     | public     | determine similarities and distance between strings
 plpgsql                | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis                | 3.0.1   | public     | PostGIS geometry, geography, and raster spatial types and functions
 postgis_tiger_geocoder | 3.0.1   | tiger      | PostGIS tiger geocoder and reverse geocoder
 postgis_topology       | 3.0.1   | topology   | PostGIS topology spatial types and functions

当我回到旧图像时,它又可以工作了。...

0 个答案:

没有答案