容器映像更新到最新之后,Postgres容器崩溃,数据库文件与服务器不兼容
Postgres容器在启动时崩溃,并显示以下错误消息
(project) ➜ project git:(feature/62-api-custom-image-categories) ✗ docker-compose up postgres Starting project_postgres_1 ... Starting project_postgres_1 ... done Attaching to project_postgres_1 postgres_1 | FATAL: database files are incompatible with server postgres_1 | DETAIL: The data directory was initialized by PostgreSQL version 9.5, which is not compatible with this version 9.6.3. project_postgres_1 exited with code 1
我有什么select ? II已经更新图像到最新的一个
我的docker-compose.yml的部分
version: '2' volumes: ipython_history: {} services: postgres: image: mdillon/postgis ports: - "5432:5432" environment: - POSTGRES_DB=p_dev - POSTGRES_USER=p_user - POSTGRES_PASSWORD=password
是否有可能转换数据或唯一的select是删除容器(丢失所有的数据),然后重新创build它?
您准时保存,但您需要回滚到以前的版本,然后:
docker exec -it <postgres-container-id> pg_dump db_name > local.dump.sql
然后,检查转储是否正常后,清空数据库的卷,升级postgres并恢复de dump: