【发布时间】:2017-06-06 06:44:08
【问题描述】:
如何在 docker 中设置 postgresql 以持久保存到本地文件夹中?
version: '2'
services:
db:
image: postgres:9.6.1-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=a
- POSTGRES_PASSWORD=a
- POSTGRES_DB=a
volumes:
- /var/lib/postgresql:./postgres
volumes:
pgdata:
driver: local
这行不通,只能产生
ERROR: for db Cannot create container for service db: invalid volume spec "postgres": invalid volume specification: 'postgres': invalid mount config for type "volume": invalid mount path: 'postgres' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
【问题讨论】:
标签: postgresql docker docker-compose persistent-storage