[英]docker-compose postgresql persitent local storage
我如何在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.
您需要使用绝对安装路径,。/ ./postgres
应该更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.