我已按照本指南在Docker for Mac中设置群集群集: https://medium.com/@alexeiled/docker-swarm-cluster-with-docker-in-docker-on-macos-bdbb97d6bb07#.2x5gqgrkq
所有似乎都正常工作,我能够看到群集。
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
3ez478atbfrcwb66u892ccbpx worker-2 Ready Active
7qfb87e9n54q3at9enzgeeko1 worker-3 Ready Active
cnr8tyaf1qqgkpjqnn4wmnb1e * moby Ready Active Leader
eyksqiw6ewfks7t8fr48rppia worker-1 Ready Active
现在我想在swarm中创建一个docker注册表。
以下失败:
$ docker service create --name registry -p 5000:5000 \
--mount "type=bind,source=$PWD,target=/var/lib/registry" \
--reserve-memory 100m registry
与
$ docker service ps registry
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR
2xflgt6jlqlbpgdjvfzbgbsbb registry.1 registry worker-1 Ready Rejected less than a second ago "invalid bind mount source, so…"
4u3a5bsdjavwubsgw9f0qhusx \_ registry.1 registry worker-3 Shutdown Rejected 5 seconds ago "invalid bind mount source, so…"
bqtbchxwjry7repyb7q30yes7 \_ registry.1 registry worker-1 Shutdown Rejected 10 seconds ago "invalid bind mount source, so…"
3e32pquyatzdnu8jvc88tfaih \_ registry.1 registry worker-3 Shutdown Rejected 15 seconds ago "invalid bind mount source, so…"
563lpzhz10ugu6tbckdzx41xe \_ registry.1 registry worker-1 Shutdown Rejected 20 seconds ago "invalid bind mount source, so…"
检查容器给我:
...
...
...
"ContainerSpec": {
"Image": "registry",
"Mounts": [
{
"Type": "bind",
"Source": "/Users/user1/cd-summit/docker",
"Target": "/var/lib/registry"
}
]
},
...
...
...
"Status": {
"Timestamp": "2016-11-17T12:36:06.714513328Z",
"State": "rejected",
"Message": "resolving controller failed",
"Err": "invalid bind mount source, source path not found: /Users/user1/cd-summit/docker",
"ContainerStatus": {}
},
...
...
...
我发现http://lucjuggery.com/blog/?p=753允许我进入Mac上的moby VM。可以在moby中看到挂载,上面的命令没有问题,让注册表运行:
$ docker service ps registry
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR
7iw0jig2ysi5t7ha6422mulwc registry.1 registry moby Running Running 33 minutes ago
当所有其他命令似乎都有效时,为什么它不能从本地docker客户端工作?