Distribution Registry
External
Internal
Old Content (TO REFACTOR)
Docker caches images downloaded from remote repositories locally, in a local registry. This local registry is also referred to as Docker's local storage area, and it usually lives under /var/lib/docker. Depending on the storage driver in use, the local storage area is mounted under /var/lib/docker/devicemapper, /var/lib/docker/overlay, etc. The content of the local registry can be queried with docker images. Images can be removed from the local registry with docker rmi.
Docker Registry - Exposing the Content of the Local Image Registry over TCP
The content of the local image registry can be exposed over the network, in a conceptually similar manner to how Docker Hub is doing it. This is done by a "registry" container, whose image can be pulled from Docker Hub. According to Docker documentation, "the Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker image."
Note that by default the Docker Registry container starts with HTTP support only, so all other Docker servers that use it must be configured to allow it as an "insecure registry", with --insecure-registry as described here.
By default, the registry data is persisted as a Docker volume on the local host filesystem, in a directory structure similar to the one shown below. The location can be customized as shown here.
# tree ./local-registry/
./local-registry/
└── docker
└── registry
└── v2
├── blobs
│ └── sha256
│ ├── 3f
│ │ └── 3fd9065eaf02feaf94d68376da52541925650b81698c53c6824d92ff63f98353
│ │ └── data
│ ├── 8c
│ │ └── 8c03bb07a531c53ad7d0f6e7041b64d81f99c6e493cb39abba56d956b40eacbc
│ │ └── data
│ └── ff
│ └── ff3a5c916c92643ff77519ffa742d3ec61b7f591b6b7504599d95a4a41134e28
│ └── data
└── repositories
└── test
├── _layers
│ └── sha256
│ ├── 3fd9065eaf02feaf94d68376da52541925650b81698c53c6824d92ff63f98353
│ │ └── link
│ └── ff3a5c916c92643ff77519ffa742d3ec61b7f591b6b7504599d95a4a41134e28
│ └── link
├── _manifests
│ ├── revisions
│ │ └── sha256
│ │ └── 8c03bb07a531c53ad7d0f6e7041b64d81f99c6e493cb39abba56d956b40eacbc
│ │ └── link
│ └── tags
│ └── latest
│ ├── current
│ │ └── link
│ └── index
│ └── sha256
│ └── 8c03bb07a531c53ad7d0f6e7041b64d81f99c6e493cb39abba56d956b40eacbc
│ └── link
└── _uploads
For details on how to operate the registry, see:
Docker Registry as a Pull-Through Cache