Docker Swarm for Owncloud

HI, I am new to docker and docker swarm. currently I have 2 vm master and worker running ubuntu with docker installed.

I have created a service “docker service create --name owncloud-server -p 80:80 --replicas 2 owncloud”. it can be accessed through browser, but the question i have is the both node (master and worker) did not have the same content.

My goal is if one of the node down, the data or content will be there. I follow from this link https://sysally.com/blog/howto-high-availability-docker-swarm/.

Thanks for your help:)

A single replica combined with a usefull healthcheck and restart_policy would already do what you ask for. The swarm scheduler will take care to keep the number of declared replicas running - if one container dies, another one will be created instead.

Starting additional replicas only makes sense if the application is stateless or provides a mechanism to share session amongst the replicas. This is not docker related and should be covered in the owncloud documentation.