title: Redis cluster with docker swarm using docker compose
body: <p>I'm just learning docker and all of its goodness like swarm and compose. My intention is to create a Redis cluster in docker swarm.</p>
  
  <p>Here is my compose file - </p>
  
  <pre><code>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
  </code></pre>
  
  <p>If I add the <code>network: - host</code> then none of the containers start, if I remove it then the containers start but when I try to connect it throws an error like <code>CLUSTERDOWN Hash slot not served</code>.</p>
  
  <p>Specs - </p>
  
  <pre><code>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
  </code></pre>