如何使用docker-compose.yml版本“1”安装并运行postgress
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进行testing时,它显示“用户postgress没有密码” ,
那么从YML文件stream是正确的,我想简单地把postgress和数据端docker-container,所以如何做到这一点?
我将使用命名卷而不是托pipe映射卷:
postgres96: image: postgres:9.6 ports: - "5432:5432" volumes: - data:/var/lib/postgresql/data environment: POSTGRES_PASSWORD: admin@123 POSTGRES_USER: postgres
可能您的文件夹中存在权限问题。
您的数据保存在容器外的卷中。 然后检查:
docker volume ls
也可以使用docker-compose作为:
docker-compose up -d
而不是“
和
docker-compose logs -f
有关更多信息,这是我的日志的最后一部分:
postgres96_1 | PostgreSQL init process complete; ready for start up. postgres96_1 | postgres96_1 | LOG: database system was shut down at 2016-11-14 21:05:51 UTC 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 postgres96_1 | LOG: incomplete startup packet
问候