1: docker-compose.yml
postgres96:
image: postgres:9.6
ports:
- "5432:5432"
volumes:
- ./Postgres/data:/var/lib/postgresql/data
env:
POSTGRES_PASSWORD: admin@123
POSTGRES_USER: postgres
2) $ docker-compose up &
postgres96_1 | LOG: database system was not properly shut down; automatic recovery in progress
postgres96_1 | LOG: invalid record length at 0/1570D50: wanted 24, got 0
postgres96_1 | LOG: redo is not required
postgres96_1 | LOG: MultiXact member wraparound protections are now enabled
postgres96_1 | LOG: database system is ready to accept connections
postgres96_1 | LOG: autovacuum launcher started
但是,当在Windows上从pg-admin-iv测试时,它显示'用户postgress没有密码',
那么YML文件中的流程是否正确,我只想简单地将postgress升级并将数据放在docker容器之外,如何做到这一点?
docker-compose down -v
,它将会把容器和卷一起销毁,但命名的卷不会被删除。然后使用docker-compose up -d
创建一个新的容器,这样你应该能在其中看到你的表格。 - Carlos Rafael Ramirez