Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions daemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io/ioutil"
"os"
"reflect"
"runtime"
"strings"
"sync"

Expand Down Expand Up @@ -197,10 +196,6 @@ func New() *Config {
config := Config{}
config.LogConfig.Config = make(map[string]string)
config.ClusterOpts = make(map[string]string)

if runtime.GOOS != "linux" {
config.V2Only = true
}
return &config
}

Expand Down
5 changes: 0 additions & 5 deletions daemon/image_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/docker/docker/distribution"
progressutils "github.com/docker/docker/distribution/utils"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/registry"
"github.com/opencontainers/go-digest"
"golang.org/x/net/context"
)
Expand Down Expand Up @@ -113,10 +112,6 @@ func (daemon *Daemon) GetRepository(ctx context.Context, ref reference.Named, au
)

for _, endpoint := range endpoints {
if endpoint.Version == registry.APIVersion1 {
continue
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing this; should we produce an error here? Although the codebase in this repository should no longer return v1 endpoints, the code is just one implementation of the interface; other implementations may still return v1 endpoints (or mixed v1/v2 endpoints); https://github.com/moby/moby/blob/master/registry/service.go#L28-L29

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove registry.APIVersion1 so that it could no longer be used by other implementations

}

repository, confirmedV2, lastError = distribution.NewV2Repository(ctx, repoInfo, endpoint, nil, authConfig, "pull")
if lastError == nil && confirmedV2 {
break
Expand Down
22 changes: 1 addition & 21 deletions distribution/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ func newPuller(endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo,
repoInfo: repoInfo,
}, nil
case registry.APIVersion1:
return &v1Puller{
v1IDService: metadata.NewV1IDService(imagePullConfig.MetadataStore),
endpoint: endpoint,
config: imagePullConfig,
repoInfo: repoInfo,
}, nil
return nil, fmt.Errorf("unsupported version %d for registry %s", endpoint.Version, endpoint.URL)
}
return nil, fmt.Errorf("unknown version %d for registry %s", endpoint.Version, endpoint.URL)
}
Expand Down Expand Up @@ -80,26 +75,12 @@ func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo
// error is the ones from v2 endpoints not v1.
discardNoSupportErrors bool

// confirmedV2 is set to true if a pull attempt managed to
// confirm that it was talking to a v2 registry. This will
// prevent fallback to the v1 protocol.
confirmedV2 bool

// confirmedTLSRegistries is a map indicating which registries
// are known to be using TLS. There should never be a plaintext
// retry for any of these.
confirmedTLSRegistries = make(map[string]struct{})
)
for _, endpoint := range endpoints {
if imagePullConfig.RequireSchema2 && endpoint.Version == registry.APIVersion1 {
continue
}

if confirmedV2 && endpoint.Version == registry.APIVersion1 {
logrus.Debugf("Skipping v1 endpoint %s because v2 registry was detected", endpoint.URL)
continue
}

if endpoint.URL.Scheme != "https" {
if _, confirmedTLS := confirmedTLSRegistries[endpoint.URL.Host]; confirmedTLS {
logrus.Debugf("Skipping non-TLS endpoint %s for host/port that appears to use TLS", endpoint.URL)
Expand Down Expand Up @@ -129,7 +110,6 @@ func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo
default:
if fallbackErr, ok := err.(fallbackError); ok {
fallback = true
confirmedV2 = confirmedV2 || fallbackErr.confirmedV2
if fallbackErr.transportOK && endpoint.URL.Scheme == "https" {
confirmedTLSRegistries[endpoint.URL.Host] = struct{}{}
}
Expand Down
Loading