docker --mount error: ContainerSpec: "—-mount" is not a valid repository/tag
docker --mount error: ContainerSpec: "—-mount" is not a valid repository/tag
我想使用带有 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
命令但它也不接受它。任何帮助表示赞赏。
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
我想使用带有 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
命令但它也不接受它。任何帮助表示赞赏。
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