【问题标题】:docker --mount error: ContainerSpec: "—-mount" is not a valid repository/tagdocker --mount 错误:ContainerSpec:“--mount”不是有效的存储库/标签
【发布时间】:2017-12-22 00:29:52
【问题描述】:

我想使用带有 docker swarm 节点的卷,所以我想翻译这个使用卷的 no-swarm 命令:

 docker run --name dev_db -v /tmp/postgres:/var/lib/postgresql/data -d postgres 

到这个群命令:

docker service create —-mount 'type=bind,src=/tmp/postgres,dst=/var/lib/postgresql/data,readonly' -—name dev -d -e contraint:node==/swarm1/  postgres
Error response from daemon: rpc error: code = InvalidArgument desc = ContainerSpec: "—-mount" is not a valid repository/tag

问题是我认为 AFAIK 可能我错了,但 swarm 不接受卷,所以这就是我想出这个 --mount 命令但它也不接受它的原因。任何帮助表示赞赏。

【问题讨论】:

    标签: docker docker-swarm docker-volume


    【解决方案1】:

    Swarm 确实支持挂载卷,所以我认为问题只是您的命令中的拼写错误“--mount”应该是“--mount”。另外我认为你还有另一个错字,约束应该是约束,我认为约束不应该起作用。如果要使用特定节点,请使用例如 node.hostname == nodename 和 have a look on the examples in Docker docs。另外我认为 -e 应该被删除,因为你没有使用环境变量。

    尝试:

    docker service create --mount 'type=bind,src=/tmp/postgres,dst=/var/lib/postgresql/data,readonly' --name dev -d --constraint 'node==/swarm1/'  postgres
    

    【讨论】:

      猜你喜欢
      • 2018-06-18
      • 1970-01-01
      • 2017-07-05
      • 2018-09-25
      • 1970-01-01
      • 2018-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多