-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pull through cache ability to the Registry. #779
Add pull through cache ability to the Registry. #779
Conversation
1bae712
to
e39b171
Compare
bf39258
to
375afb0
Compare
375afb0
to
de5d7ca
Compare
disabled: true | ||
middleware: | ||
repository: | ||
- name: proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does one have to configure both middlewares for this to work? I'm worried people will omit one or other or not even understand this. Can we make it so that the repository
portion is not required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduced to a single middleware configuration.
de5d7ca
to
4d58472
Compare
For example, if your mirror is serving on http://10.0.0.2:5000, you would run: | ||
|
||
``` | ||
docker --registry-mirror=http://10.0.0.2:5000 -d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, wouldn't the docker daemon complain about this example address as it is not https?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would. I'll change the example to https (and link the certs documentation)
abb5f3b
to
ad39ef9
Compare
Now 100% unmiddlewared, @stevvooe |
LGTM |
scheduler *scheduler.TTLExpirationScheduler | ||
} | ||
|
||
var _ distribution.BlobStore = proxyBlobStore{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this line do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It asserts that proxyBlobStore implements the distribution.BlobStore
interface.
On Tue, Aug 4, 2015 at 3:46 PM, Aaron Lehmann notifications@github.com
wrote:
In registry/proxy/proxyblobstore.go
#779 (comment):
- "github.com/docker/distribution"
- "github.com/docker/distribution/context"
- "github.com/docker/distribution/digest"
- "github.com/docker/distribution/registry/proxy/scheduler"
+)
+// todo(richardscothern): from cache control header or config file
+const blobTTL = time.Duration(24 * 7 * time.Hour)
+
+type proxyBlobStore struct {
- localStore distribution.BlobStore
- remoteStore distribution.BlobService
- scheduler *scheduler.TTLExpirationScheduler
+}
+var _ distribution.BlobStore = proxyBlobStore{}
What does this line do?
—
Reply to this email directly or view it on GitHub
https://github.com/docker/distribution/pull/779/files#r36251728.
LGTM, but note minor comments above. |
…figured with a new `proxy` section in the configuration file. Create a new registry type which delegates storage to a proxyBlobStore and proxyManifestStore. These stores will pull through data if not present locally. proxyBlobStore takes care not to write duplicate data to disk. Add a scheduler to cleanup expired content. The scheduler runs as a background goroutine. When a blob or manifest is pulled through from the remote registry, an entry is added to the scheduler with a TTL. When the TTL expires the scheduler calls a pre-specified function to remove the fetched resource. Add token authentication to the registry middleware. Get a token at startup and preload the credential store with the username and password supplied in the config file. Allow resumable digest functionality to be disabled at runtime and disable it when the registry is a pull through cache. Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
ad39ef9
to
94935f3
Compare
Add pull through cache ability to the Registry.
I was wondering how to set up a mirror registry for a private registry (gcr.io, for example). |
@dalanlan this is still experimental - mirroring of private registries is not yet a supported scenario (by docker itself). |
Ic. Many thanks ;-) |
Any pr i can trace though? |
Or this feature has been fully finished by #779, remaining experimental though. If that's the case, any new milestone ( will not be Registry/2.1 anymore ) in plan? :) |
Awesome, so far the pull through caching is working well for me on docker engine 1.8.0-rc2. I'll put more load on it tomorrow 👍 |
@dalanlan it's a bit early for registry 2.2. For now, the docker engine itself only support Hub mirroring (though the registry side of it is not limited). About the "experimental" status: we feel mirroring needs to be fire-tested before calling it "stable". |
@matt @olivier Do we have some instructions to set this up? It'll be super On Fri, Aug 7, 2015 at 1:23 AM, Olivier Gambier notifications@github.com
|
@lvlv - I just did the following:
I have a
|
Please stop commenting on merged issues. This is not a support channel. |
Add pull through cache ability to the Registry.
Create a Repository middleware which delegates storage to a proxyBlobStore
and proxyManifestStore. These stores will pull through data if not present
locally.
Create a Registry middleware which runs a scheduler to remove
expired content.
The scheduler runs as a background goroutine. When a blob
or manifest is pulled through from the remote registry,
an entry is added to the scheduler with a TTL. When the
TTL expires the scheduler calls a pre-specified function
to remove the fetched resource.
Add token authentication to the registry middleware.
Get a token at startup and preload the credential store
with the username and password supplied in the config file.
Signed-off-by: Richard Scothern richard.scothern@gmail.com