V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sjmcefc2
V2EX  ›  Docker

这个 dockercompose 哪里错了呢?

  •  
  •   sjmcefc2 · 84 天前 · 757 次点击
    这是一个创建于 84 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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:

    • ~/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: In file '.\docker-compose.yml', volume must be a mapping, not an array.

    11 条回复    2021-08-04 21:12:05 +08:00
    263
        1
    263   84 天前
    volume 搞反了吧,容器里面怎么有 windows 的路径。
    sjmcefc2
        2
    sjmcefc2   84 天前
    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
        3
    chotow   84 天前
    https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
    顶级 volumes 字段不能用数组形式,详情见以上链接。
    sjmcefc2
        4
    sjmcefc2   84 天前
    这样?
    sjmcefc2
        5
    sjmcefc2   84 天前
    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
        6
    263   84 天前
    看的眼花,貌似看错了,正常排版的 docker-compose.yml 能来一个么。
    sjmcefc2
        7
    sjmcefc2   84 天前
    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
        8
    sjmcefc2   84 天前
    这个原来在 linux 的版本,我修改成 windows 版本。
    zjj19950716
        9
    zjj19950716   84 天前
    顶级的 volume 还能 bind 宿主机目录吗
    263
        10
    263   84 天前   ❤️ 1
    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
        11
    sjmcefc2   84 天前
    @263 学到了。太感谢了
    关于   ·   帮助文档   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   1064 人在线   最高记录 5497   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 21:32 · PVG 05:32 · LAX 14:32 · JFK 17:32
    ♥ Do have faith in what you're doing.