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

这个 dockercompose 哪里错了呢?

  •  
  •   sjmcefc2 · 2021-08-04 14:14:23 +08:00 · 1684 次点击
    这是一个创建于 1205 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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.

    12 条回复    2024-03-28 10:47:58 +08:00
    263
        1
    263  
       2021-08-04 14:21:57 +08:00
    volume 搞反了吧,容器里面怎么有 windows 的路径。
    sjmcefc2
        2
    sjmcefc2  
    OP
       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
        3
    chotow  
       2021-08-04 14:33:15 +08:00
    https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
    顶级 volumes 字段不能用数组形式,详情见以上链接。
    sjmcefc2
        4
    sjmcefc2  
    OP
       2021-08-04 14:33:23 +08:00
    这样?
    sjmcefc2
        5
    sjmcefc2  
    OP
       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
        6
    263  
       2021-08-04 14:56:23 +08:00
    看的眼花,貌似看错了,正常排版的 docker-compose.yml 能来一个么。
    sjmcefc2
        7
    sjmcefc2  
    OP
       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
        8
    sjmcefc2  
    OP
       2021-08-04 15:05:17 +08:00
    这个原来在 linux 的版本,我修改成 windows 版本。
    zjj19950716
        9
    zjj19950716  
       2021-08-04 16:08:26 +08:00
    顶级的 volume 还能 bind 宿主机目录吗
    263
        10
    263  
       2021-08-04 16:39:25 +08:00   ❤️ 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  
    OP
       2021-08-04 21:12:05 +08:00
    @263 学到了。太感谢了
    chenjunqiang
        12
    chenjunqiang  
       238 天前
    @sjmcefc2 方便贴下完整的 yml 吗?

    #11 楼的这个,贴在哪里?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   960 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 21:22 · PVG 05:22 · LAX 13:22 · JFK 16:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.