docker-编写 postgresql 持久本地存储
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
应该改变。
如何在 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
应该改变。