如何使用docker-compose和映射卷来保存postgressql映像的数据库

我有这个docker – 撰写哪些工作在Mac和Linux上,但不是在Windows上:(任何想法如何解决这个问题?


PS我已经知道外部卷的解决scheme,我不喜欢,因为我想能够备份数据库文件。 泊坞窗,compose.yml:

version: "3.3" services: postgres: build: context: . volumes: - "./dotcms/pgdata:/var/lib/postgresql/data" image: "postgres:9.6-alpine" environment: PGDATA: "/var/lib/postgresql/data/pgdata" POSTGRES_DB: mydb 

错误信息:

 ... postgres_1 | syncing data to disk ... initdb: could not fsync file "/var/lib/postgresql/data/mypg/base/1": Invalid argument postgres_1 | initdb: could not fsync file "/var/lib/postgresql/data/mypg/base/12403": Invalid argument postgres_1 | initdb: could not fsync file "/var/lib/postgresql/data/mypg/base/12404": Invalid argument postgres_1 | initdb: could not fsync file "/var/lib/postgresql/data/mypg/base": Invalid argument ... 

结束了退出代码1