使用 docker-compose 1.8 包与 Swarm 1.12

Using docker-compose 1.8 bundle with Swarm 1.12

我正在使用 docker 1.12 版本和 compose 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

这是我得到的错误:

WARNING: Unsupported top level key 'volumes' - ignoring

WARNING: Unsupported key 'volumes' in services.momgodb - ignoring

此致

目前还不支持,您可以从错误消息中看到。新的 swarm 特性仍在非常积极的开发中,捆绑包本身是实验性的,所以还有很多像这样的部分仍在等待开发。

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