0

I have one serious doubt in docker swarm . I have created the docker-machine in VM manager1 worker1 worker2

And joined all the worker to manager and create the service like docker service create --replicas 3 -p 80:80 --name web nginx

I change the index.html in docker service in manager1

When I run the url like http://192.168.99.100 it showing the index.html file that I have changed but the remaining 2 node showing the default nginx page

What is the concept of swarm ? Whether it is used only for the service failure ?

How to make the centralized data storage in docker swarm.

premredhat
  • 23
  • 5
  • The nodes are loadbalanced. Thus when hitting the url multiple times you should be redirected to different nodes. – yamenk Dec 14 '17 at 10:08

1 Answers1

0

There are a few approaches to ensuring the same app and data are available on all nodes.

  1. Your code (like nginx with your web app) should be built into an image, sent to a registry, and pulled to a Swarm service. That way the same app/code/site is in all the containers of that service.

  2. If you need persistent data, like a database, then you should use a plugin volume driver that lets you store the unique data on shared storage.

Bret Fisher
  • 8,164
  • 2
  • 31
  • 36