这个 dockercompose 哪里错了呢?

2021-08-04 14:14:23 +08:00
 sjmcefc2

version: '3' services: app: container_name: app-server image: nextcloud:fpm stdin_open: true tty: true restart: always expose: - '80' - '9000' networks: - onlyoffice volumes: - app_data:/var/www/html onlyoffice-document-server: container_name: onlyoffice-document-server image: onlyoffice/documentserver:latest stdin_open: true tty: true restart: always networks: - onlyoffice expose: - '80' - '443' volumes: - document_data:/var/www/onlyoffice/Data - document_log:/var/log/onlyoffice nginx: container_name: nginx-server image: nginx stdin_open: true tty: true restart: always ports: - 80:80 - 443:443 networks: - onlyoffice volumes: - .\nginx.conf:/etc/nginx/nginx.conf - app_data:/var/www/html db: container_name: mariadb image: mariadb restart: always volumes: - mysql_data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=MyR00tSQ1! - MYSQL_PASSWORD=N3xtCl0ud! - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - TZ: Asia/Shanghai networks: - onlyoffice networks: onlyoffice: driver: 'bridge' volumes:

一直提示 ERROR: In file '.\docker-compose.yml', volume must be a mapping, not an array.

1712 次点击
所在节点    Docker
12 条回复
263
2021-08-04 14:21:57 +08:00
volume 搞反了吧,容器里面怎么有 windows 的路径。
sjmcefc2
2021-08-04 14:33:09 +08:00
volumes:
D://docker/onlyoffice/document_data:document_data
D://docker/onlyoffice/document_log:document_log
D://docker/onlyoffice/app_data:app_data
D://docker/onlyoffice/mysql_data:mysql_data
chotow
2021-08-04 14:33:15 +08:00
https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
顶级 volumes 字段不能用数组形式,详情见以上链接。
sjmcefc2
2021-08-04 14:33:23 +08:00
这样?
sjmcefc2
2021-08-04 14:46:39 +08:00
volumes:
data:
external:
document_data: D://docker/onlyoffice/document_data
document_log:D://docker/onlyoffice/document_log
app_data:D://docker/onlyoffice/app_data
mysql_data:D://docker/onlyoffice/mysql_data



ERROR: Error while attempting to convert volume.data.external to appropriate type: "document_data:d://docker/onlyoffice/document_data document_log:d://docker/onlyoffice/document_log app_data:d://docker/onlyoffice/app_data mysql_data:d://docker/onlyoffice/mysql_data" is not a valid boolean value
263
2021-08-04 14:56:23 +08:00
看的眼花,貌似看错了,正常排版的 docker-compose.yml 能来一个么。
sjmcefc2
2021-08-04 15:00:41 +08:00
version: '3'
services:
app:
container_name: app-server
image: nextcloud:fpm
stdin_open: true
tty: true
restart: always
expose:
- '80'
- '9000'
networks:
- onlyoffice
volumes:
- app_data:/var/www/html
onlyoffice-document-server:
container_name: onlyoffice-document-server
image: onlyoffice/documentserver:latest
stdin_open: true
tty: true
restart: always
networks:
- onlyoffice
expose:
- '80'
- '443'
volumes:
- document_data:/var/www/onlyoffice/Data
- document_log:/var/log/onlyoffice
nginx:
container_name: nginx-server
image: nginx
stdin_open: true
tty: true
restart: always
ports:
- 80:80
- 443:443
networks:
- onlyoffice
volumes:
- .\nginx.conf:/etc/nginx/nginx.conf
- app_data:/var/www/html
db:
container_name: mariadb
image: mariadb
restart: always
volumes:
- mysql_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=MyR00tSQ1!
- MYSQL_PASSWORD=N3xtCl0ud!
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- TZ: Asia/Shanghai
networks:
- onlyoffice
networks:
onlyoffice:
driver: 'bridge'
volumes:
data:
external:
document_data:D://docker/onlyoffice/document_data
document_log:D://docker/onlyoffice/document_log
app_data:D://docker/onlyoffice/app_data
mysql_data:D://docker/onlyoffice/mysql_data
sjmcefc2
2021-08-04 15:05:17 +08:00
这个原来在 linux 的版本,我修改成 windows 版本。
zjj19950716
2021-08-04 16:08:26 +08:00
顶级的 volume 还能 bind 宿主机目录吗
263
2021-08-04 16:39:25 +08:00
volumes:
document_data:
driver: local
driver_opts:
o: bind
type: none
device: D:/docker/onlyoffice/document_data
document_log:
driver: local
driver_opts:
o: bind
type: none
device: D:/docker/onlyoffice/document_log
app_data:
driver: local
driver_opts:
o: bind
type: none
device: D:/docker/onlyoffice/app_data
mysql_data:
driver: local
driver_opts:
o: bind
type: none
device: D:/docker/onlyoffice/mysql_data
sjmcefc2
2021-08-04 21:12:05 +08:00
@263 学到了。太感谢了
chenjunqiang
275 天前
@sjmcefc2 方便贴下完整的 yml 吗?

#11 楼的这个,贴在哪里?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/793600

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX