Himanshu
Himanshu

Reputation: 363

How to get Shared file system for docker containers running on different hosts?

I have two docker containers running on two separate hosts. What can I do to make sure that both the containers use a share the data stored on a third host. Because of some restrictions, I can not do volume mapping of host to container. And it seems you can't mount remote file systems directly on containers due to security restrictions.

What should be my approach in handling this requirement?

Upvotes: 0

Views: 325

Answers (2)

Giuseppe Scrivano
Giuseppe Scrivano

Reputation: 1635

what restrictions? Ensure you specify the mode when you mount the volume, like -v /from:/to:Z (to relabel the mount point) or -v /from:/to:rw (to mount in read write mode)

Upvotes: 0

c4f4t0r
c4f4t0r

Reputation: 1641

share via nfs the filesystem from your third host and mounting in the two hosts and after that, mapping the nfs share mountpoint to your container, you using docker run -v /nfsmount:/nfsmount -ti docker_tag /bin/bash

Upvotes: 1

Related Questions