How to share images between multiple docker hosts?

I have two hosts and a docker is installed in each.

As you know, each docker saves images in the local directory /var/lib/docker .

So, if I want to use some kind of image, for example ubuntu , I have to do docker pull to load from the Internet on each host.

I think it is slow.

Can I save images in a shared disk array? Then, several hosts pull out the image once so that each host with access to the shared drive uses the image directly.

Is this possible or good practice? Why is docker not created this way?

To implement this, you may need to hack the docker source code.

+7
docker docker-registry dockerhub
source share
3 answers

You looked at this article.

Docking Apt-Cacher-ng service

http://docs.docker.com/examples/apt-cacher-ng/

Extract

This container makes the second download of any package almost instant.

At least one node will be very fast, and I think that it would be possible to tell the second node to use the cache of the first node.

Edit: you can run your own registry using a command similar to

sudo docker run -p 5000:5000 registry

cm

https://github.com/docker/docker-registry

0
source share

Update in 2016.1.25 Docker mirroring feature deprecated

So this answer is not applicable now, leave it for reference

Old information

You need mirror mode for the docker registry, see https://docs.docker.com/v1.6/articles/registry_mirror/

It is supported directly from docker-registry

Of course, you can use public mirroring locally.

0
source share

What you are trying to do should not work as cpuguy83 described in this is the github / docker problem .

Really:

The base storage driver will need to synchronize access.

Sharing /var/lib/docker far from enough and will not work !

According to doc.docker.com/registry :

You must use the registry if you want:

  • tightly control where your images are stored.
  • Fully own the conveyor belt of your images.
  • tightly integrate image storage and distribution into your development workflow

So, I guess this is the best option to work (but I think you got this information - I will just add it here to update the details).

Good luck

0
source share

All Articles