'In docker swarm, every worker has it's own /var with different data compared to other workers, so the workers are different, how can I handle it?
On an Ubuntu image,
There is a php code where a web server (NGINX) gets an photo from end user and uploads the photo on /var
I create an image from the above image
Now with docker swarm, where multiple replicas (workers) of the above image are created as containers on different servers,
How can the user (An android application which gets photo from user and upload it on server) access his/her uploaded image on the same server (worker) where he/she uploaded his/her image?
There would be several replicas with several /var
Every worker will have it's own /var with different data compared to one other worker
Solution 1:[1]
You have basically 3 options:
NFS: The docker local volume driver supports syntax for mounting a nfs share. Have a server somewhere with an nfs share, and mount the share into each container as a volume.
RClone: Store the files in a AWS S3 or Minio (on prem) S3 bucket. Install rclone's docker volume plugin on all worker nodes to mount the storage as a volume the service can access.
GlusterFS: Build a Gluster FS cluster and to store the files install one of the opensource or available glusterfs docker volume plugins.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris Becke |
