Skip to content

Commit

Permalink
Merge pull request #7531 from greut/docker-v19.03.8
Browse files Browse the repository at this point in the history
Docker v19.03.8
  • Loading branch information
Mahmood Ali authored Mar 30, 2020
2 parents 5855b62 + 4667440 commit a7999c2
Show file tree
Hide file tree
Showing 80 changed files with 2,692 additions and 2,598 deletions.
4 changes: 2 additions & 2 deletions drivers/docker/driver_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package docker

import (
"github.com/docker/docker/daemon/caps"
"github.com/docker/docker/oci/caps"
docker "github.com/fsouza/go-dockerclient"
)

Expand All @@ -19,7 +19,7 @@ func tweakCapabilities(basics, adds, drops []string) ([]string, error) {
basics[i] = "CAP_" + cap
}

effectiveCaps, err := caps.TweakCapabilities(basics, adds, drops)
effectiveCaps, err := caps.TweakCapabilities(basics, adds, drops, nil, false)
if err != nil {
return effectiveCaps, err
}
Expand Down
26 changes: 25 additions & 1 deletion drivers/docker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"strings"

"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/config/types"
"github.com/docker/distribution/reference"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/registry"
docker "github.com/fsouza/go-dockerclient"
)
Expand Down Expand Up @@ -117,7 +119,7 @@ func authFromDockerConfig(file string) authBackend {

return firstValidAuth(repo, []authBackend{
func(string) (*docker.AuthConfiguration, error) {
dockerAuthConfig := registry.ResolveAuthConfig(cfile.AuthConfigs, repoInfo.Index)
dockerAuthConfig := registryResolveAuthConfig(cfile.AuthConfigs, repoInfo.Index)
auth := &docker.AuthConfiguration{
Username: dockerAuthConfig.Username,
Password: dockerAuthConfig.Password,
Expand Down Expand Up @@ -280,3 +282,25 @@ func parseVolumeSpecLinux(volBind string) (hostPath string, containerPath string

return parts[0], parts[1], m, nil
}

// ResolveAuthConfig matches an auth configuration to a server address or a URL
// copied from https://github.com/moby/moby/blob/ca20bc4214e6a13a5f134fb0d2f67c38065283a8/registry/auth.go#L217-L235
// but with the CLI types.AuthConfig type rather than api/types
func registryResolveAuthConfig(authConfigs map[string]types.AuthConfig, index *registrytypes.IndexInfo) types.AuthConfig {
configKey := registry.GetAuthConfigKey(index)
// First try the happy case
if c, found := authConfigs[configKey]; found || index.Official {
return c
}

// Maybe they have a legacy config file, we will iterate the keys converting
// them to the new format and testing
for r, ac := range authConfigs {
if configKey == registry.ConvertToHostname(r) {
return ac
}
}

// When all else fails, return an empty auth config
return types.AuthConfig{}
}
120 changes: 86 additions & 34 deletions vendor/github.com/docker/cli/cli/config/configfile/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a7999c2

Please sign in to comment.