我正在使用bitnami/postgresql:9.6停靠程序映像启动postgresql。我希望在容器重新启动和我使用命名卷之间保持数据。下面是我的docker文件配置:
postgresql:
image: 'bitnami/postgresql:9.6'
ports:
- 5432
environment:
- POSTGRESQL_REPLICATION_MODE=<name>
- POSTGRESQL_REPLICATION_USER=<name>
- POSTGRESQL_REPLICATION_PASSWORD=<name>
- POSTGRESQL_USERNAME=<name>
- POSTGRESQL_PASSWORD=<name>
- POSTGRESQL_DATABASE=<name>
- POSTGRES_INITDB_ARGS="--encoding=utf8"
volumes:
- volume-postgresql:/bitnami/postgresql/data
volumes:
volume-postgresql:但是,当我重新启动容器时,我会得到以下错误:
postgresql | nami INFO Initializing postgresql
postgresql | Error executing 'postInstallation': initdb: directory "/opt/bitnami/postgresql/data" exists but is not empty
postgresql | If you want to create a new database system, either remove or empty
postgresql | the directory "/opt/bitnami/postgresql/data" or run initdb
postgresql | with an argument other than "/opt/bitnami/postgresql/data".你能帮我找出问题所在吗?实际上我以为卷是用来做这些用途的..。可能我做错了什么
发布于 2017-11-03 12:12:10
好吧,看起来我使用了错误的目录。基于这个站点,我应该使用/bitnami/postgresql/data而不是/bitnami。
https://stackoverflow.com/questions/47095329
复制相似问题