如何使用 docker-compose.yml 版本“1”安装和 运行 postgres
How to install and run postgress using docker-compose.yml version "1"
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-组合&
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 进行测试时它显示 'user postgress has no password',
那么来自 YML 文件的流程是否正确,我只想简单地启动 postgress 并将数据放在 docker-container 之外,那么如何实现呢?
我会使用 命名卷 而不是托管映射卷:
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-组成为:
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
此致
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-组合&
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 进行测试时它显示 'user postgress has no password',
那么来自 YML 文件的流程是否正确,我只想简单地启动 postgress 并将数据放在 docker-container 之外,那么如何实现呢?
我会使用 命名卷 而不是托管映射卷:
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-组成为:
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
此致