【问题标题】:Using docker-compose 1.8 bundle with Swarm 1.12将 docker-compose 1.8 捆绑包与 Swarm 1.12 一起使用
【发布时间】:2016-07-17 14:42:20
【问题描述】:

我正在使用 docker 1.12 版本并撰写 1.8。 我正在尝试了解如何为映像安装卷。 这是用于创建集群并将数据保存到本地卷

这是 docker-compose.yml:

version: '2'
services:
  mongod:
    image: rotemsecupi/mongodb-ubuntu
    ports:
      - "27017"
    volumes:
       - /home/dbdata/mongodb:/data/db
    command: mongod --smallfiles --quiet --logpath=/var/log/mongodb.log

这是我得到的错误:

警告:不支持的顶级键 'volumes' - 忽略

警告:services.momgodb 中不支持的键“volumes” - 忽略

最好的问候

【问题讨论】:

    标签: docker docker-compose docker-swarm


    【解决方案1】:

    目前尚不支持此功能,您可以从错误消息中看到。新的 swarm 功能仍处于非常活跃的开发阶段,并且捆绑包本身处于试验阶段,因此有很多类似的部分仍在等待开发。

    目前使用 docker service --mount 选项 (documentation is still needed on this) 在群模式中支持卷。您需要确保该卷实际存在于主机上,由于 Swarm 的性质和容器能够扩展到多个主机,这可能是此功能在优先级列表中较低的原因。

    【讨论】:

    • 我需要为所有节点运行命令 docker service --mount 还是可以在我扩展服务之前完成?
    • docker service create --mount 适用于服务中的每个任务。我还没有检查它是否支持 update 选项,让您在缩放后运行它。
    • 我运行: docker service create --replicas 1 --mount target=/home/dbdata/mongodb,source=/data/db,type=volume,writable=true --name mongo mongo: 2.6.8 和 get:invalid argument "target=/home/dbdata/mongodb,source=/data/db,type=volume,writable=true" for --mount: 'writable=true' 中的意外键 'writable' 见'docker service create --help'。
    • 看起来它告诉你不应该包含 writable=true 。如果你忽略它会发生什么?
    • 成功了!你知道我如何将 --mount target=/home/dbdata/mongodb,source=/data/db,type=volume 与 bundel 一起使用吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-25
    • 1970-01-01
    相关资源
    最近更新 更多