问题
What are the implications of exporting /var/lib/docker over NFS? The idea is to store the docker images in a server and export it to hosts which has limited memory to store and run containers. This would be useful to avoid having each host download and store it's own library of docker image. The hosts may make use of FS-Cache to limit the data transfer over network.
回答1:
The /var/lib/docker
directory is designed to be exclusively accessed by a single daemon, and should never be shared with multiple daemons.
Having multiple daemons use the same /var/lib/docker
can lead to many issues, and possible data corruption.
For example, the daemon keeps an in-memory state of which images are in use (by containers), and which ones not; multiple daemons using those image won't keep track of that (an image may be in use by another daemon), and remove the image while it's in use.
Docker also stores various other files in /var/lib/docker
, such as a key/value store for user-defined networks, which is not designed to be accessed concurrently by multiple daemons.
来源:https://stackoverflow.com/questions/36212928/implications-of-exposing-var-lib-docker-over-nfs-to-serve-hosts-with-limited-me