我是一名正在学习Docker及其优点,如Swarm和Compose的人。我的目的是在Docker Swarm中创建一个Redis群集。
以下是我的Compose文件:
version: '3'
services:
redis:
image: redis:alpine
command: ["redis-server","--appendonly yes","--cluster-enabled yes","--cluster-node-timeout 60000","--cluster-require-full-coverage no"]
deploy:
replicas: 5
restart_policy:
condition: on-failure
ports:
- 6379:6379
- 16379:16379
networks:
host:
external: true
如果我添加了
network: - host
,则容器都不会启动,如果我删除它,那么容器就能启动了,但是当我尝试连接时,会抛出CLUSTERDOWN Hash slot not served
的错误。规格 -
Windows 10
Docker Swarm Nodes -
2 Virtual Box VMs running Alpine Linux 3.7.0 with two networks
VirtualBox VM Network -
eth0 - NAT
eth1 - VirtualBox Host-only network
Docker running inside the above VMs -
17.12.1-ce