1

I am dockerising an existing node app. The app allows users to upload user images. I am thinking of creating a docker volume image, and share it amongst the running containers so that they can all write and read those images.

Questions:

  • Can I deploy the docker image on Amazon and expect all of the instances to access it?
  • Could I potentially have the image running on "cloud provider A", and allow other docker instances to access it from "cloud provider B"?
1

By default, docker volumes are local to the docker host where the container is running (as suggested by the default driver name "local"). To have a docker volume that is accessible across multiple docker hosts, you'll need to point to external storage. The most common way to do this is using an NFS server:

  # create a reusable volume
  $ docker volume create --driver local \
      --opt type=nfs \
      --opt o=addr=192.168.1.1,rw \
      --opt device=:/path/to/dir \
      foo

  # or from the docker run command
  $ docker run -it --rm \
    --mount type=volume,dst=/container/path,volume-driver=local,volume-opt=type=nfs,volume-opt=o=addr=192.168.1.1,volume-opt=device=:/host/path \
    foo

You'll need to adjust the IP's and path, and names in the above to match your own environment.

To access the volume across multiple clouds, you'll need to point to external storage that's accessible from multiple clouds.

  • Yes, yes, yes and YES. Thank you so much for your answer. I am getting into Docker as we speak, and man, I can totally understand why people are going crazy about it! – Merc Jan 3 '18 at 3:27
0

Can I deploy the docker image on Amazon and expect all of the instances to access it?

This is possible, but it doesn't come by default, you need to configure it.

If you want to share arbitrary files, you need to setup a cluster filesystem Probably one of the easier ways to do this on Amazon infrastructure is to setup S3 backed storage driver.

If you only want to share docker images, then you can simply setup your own private docker registry.

Could I potentially have the image running on "cloud provider A", and allow other docker instances to access it from "cloud provider B"?

Yes, though you need to figure out the security aspect if you don't want the images to be public. You need to setup authentication for the docker registry. How to setup these security configurations are discussed in the registry server's manual.

  • Maybe my question wasn't clear but... images can be uploaded by users all the time, using one of the instances. Your answer seems to assume that images are "read only"...? – Merc Jan 2 '18 at 3:45
  • @Merc: my answer does not assume that images are read only, why do you think my answer implies that that's the case? – Lie Ryan Jan 2 '18 at 3:59
  • Ok. So... you can deploy Docker image running on Amazon, and access it using a docker instance running on my own server? – Merc Jan 2 '18 at 8:36
  • @Merc: If you run a private registry service, then yes. You'll need to push your docker image to the private registry, then your non-Amazon server scan pull that image from your private registry. Of course the registry need to be accessible in both environments, so if you don't want your images to be publicly accessible, you should set up one of the security and authentication mechanism as described in the docs I linked. – Lie Ryan Jan 3 '18 at 1:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.