Monday, January 22, 2018

How to share a file (data) across multiple docker containers in azure

Leave a Comment

I want to run several docker containers in different regions (asia, eu, us) which host a nginx server.

However, they should all have the same configuration because I need to updated hostnames at runtime dynamically (one domain for every new tenant). So I guess it would be the easiest way to just share one config file among all containers and reload them...

So how can I share data/files among n containers on azure?

3 Answers

Answers 1

In general, unless you want to use proprietary solutions specific to the platform at hand, the best way to synchronise files between multiple systems is with the help of rsync.

For example, in DNS, there exists a specialised protocol for transferring domain zones directly within the DNS software, called AXFR; one of the authors of a newer DNS implementation suggests that this AXFR protocol is crap, and rsync over ssh works much better — http://cr.yp.to/djbdns/tcp.html — and the ssh part is a nice thing about rsync, in that it can work over plain old ssh protocol as far as interconnection between the hosts goes, not requiring any special firewall considerations.

Answers 2

Have you considered using the Azure file share.

Answers 3

Docker and Azure are out of scope here. You should consider they are all servers. You can run and scheduled bash script in each server (docker image) that retrieves the config file everyday using ftp, ssh, or even git (I would choose this options so you can keep older versions if something goes wrong).

nginx1 | nginx2 | <-----git clone yourRepository-----> |nginx.conf| nginx3 |

Of course you have to consider network/security restrictions.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment