Prevent push and pull to v1 registries by filtering the available endpoints.

Add a daemon flag to control this behaviour.  Add a warning message when pulling
an image from a v1 registry.  The default order of pull is slightly altered
with this changset.

Previously it was:
https v2, https v1, http v2, http v1

now it is:
https v2, http v2, https v1, http v1

Prevent login to v1 registries by explicitly setting the version before ping to
prevent fallback to v1.

Add unit tests for v2 only mode.  Create a mock server that can register
handlers for various endpoints.  Assert no v1 endpoints are hit with legacy
registries disabled for the following commands:  pull, push, build, run and
login.  Assert the opposite when legacy registries are not disabled.

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
This commit is contained in:
Richard Scothern
2015-10-06 18:26:17 -07:00
committed by Jessica Frazelle
parent 6321ac9182
commit 668a1758bd
12 changed files with 400 additions and 104 deletions
+7
View File
@@ -445,6 +445,13 @@ Local registries, whose IP address falls in the 127.0.0.0/8 range, are
automatically marked as insecure as of Docker 1.3.2. It is not recommended to
rely on this, as it may change in the future.
## Legacy Registries
Enabling `--no-legacy-registry` forces a docker daemon to only interact with
registries which support the V2 protocol. Specifically, the daemon will not
attempt `push`, `pull` and `login` to v1 registries. The exception to this
is `search` which can still be performed on v1 registries.
## Running a Docker daemon behind a HTTPS_PROXY
When running inside a LAN that uses a `HTTPS` proxy, the Docker Hub