diff --git a/components/engine/builder/dockerfile/clientsession.go b/components/engine/builder/dockerfile/clientsession.go index 9a5411685a..2ef5bf5462 100644 --- a/components/engine/builder/dockerfile/clientsession.go +++ b/components/engine/builder/dockerfile/clientsession.go @@ -41,7 +41,6 @@ func (cst *ClientSessionTransport) Copy(ctx context.Context, id fscache.RemoteId type ClientSessionSourceIdentifier struct { includePatterns []string caller session.Caller - sharedKey string uuid string } diff --git a/components/engine/builder/dockerfile/copy_windows.go b/components/engine/builder/dockerfile/copy_windows.go index dcf4c5acfb..f7fc6e0329 100644 --- a/components/engine/builder/dockerfile/copy_windows.go +++ b/components/engine/builder/dockerfile/copy_windows.go @@ -8,6 +8,11 @@ import ( "github.com/docker/docker/pkg/idtools" ) +var pathBlacklist = map[string]bool{ + "c:\\": true, + "c:\\windows": true, +} + func fixPermissions(source, destination string, rootIDs idtools.IDPair, overrideSkip bool) error { // chown is not supported on Windows return nil diff --git a/components/engine/builder/dockerfile/evaluator.go b/components/engine/builder/dockerfile/evaluator.go index cd4f513fad..40af56604b 100644 --- a/components/engine/builder/dockerfile/evaluator.go +++ b/components/engine/builder/dockerfile/evaluator.go @@ -203,13 +203,6 @@ func (s *dispatchState) hasFromImage() bool { return s.imageID != "" || (s.baseImage != nil && s.baseImage.ImageID() == "") } -func (s *dispatchState) isCurrentStage(target string) bool { - if target == "" { - return false - } - return strings.EqualFold(s.stageName, target) -} - func (s *dispatchState) beginStage(stageName string, image builder.Image) { s.stageName = stageName s.imageID = image.ImageID() diff --git a/components/engine/builder/dockerfile/imagecontext.go b/components/engine/builder/dockerfile/imagecontext.go index 084255d173..2301d1aab4 100644 --- a/components/engine/builder/dockerfile/imagecontext.go +++ b/components/engine/builder/dockerfile/imagecontext.go @@ -18,7 +18,6 @@ type imageSources struct { byImageID map[string]*imageMount mounts []*imageMount getImage getAndMountFunc - cache pathCache // TODO: remove } // TODO @jhowardmsft LCOW Support: Eventually, platform can be moved to options.Options.Platform, diff --git a/components/engine/builder/dockerfile/internals.go b/components/engine/builder/dockerfile/internals.go index 4c82e61588..be46d3186d 100644 --- a/components/engine/builder/dockerfile/internals.go +++ b/components/engine/builder/dockerfile/internals.go @@ -29,12 +29,6 @@ import ( "github.com/pkg/errors" ) -// For Windows only -var pathBlacklist = map[string]bool{ - "c:\\": true, - "c:\\windows": true, -} - // Archiver defines an interface for copying files from one destination to // another using Tar/Untar. type Archiver interface { diff --git a/components/engine/builder/fscache/fscache.go b/components/engine/builder/fscache/fscache.go index 880cc9d10d..7cb4c5cbe9 100644 --- a/components/engine/builder/fscache/fscache.go +++ b/components/engine/builder/fscache/fscache.go @@ -217,7 +217,6 @@ func syncFrom(ctx context.Context, cs *cachedSourceRef, transport Transport, id } type fsCacheStore struct { - root string mu sync.Mutex sources map[string]*cachedSource db *bolt.DB diff --git a/components/engine/builder/remotecontext/tarsum.go b/components/engine/builder/remotecontext/tarsum.go index 370f13d80b..78f7470b37 100644 --- a/components/engine/builder/remotecontext/tarsum.go +++ b/components/engine/builder/remotecontext/tarsum.go @@ -1,7 +1,6 @@ package remotecontext import ( - "fmt" "os" "sync" @@ -133,19 +132,6 @@ func (cs *CachableSource) Close() error { return nil } -func (cs *CachableSource) normalize(path string) (cleanpath, fullpath string, err error) { - cleanpath = cs.root.Clean(string(cs.root.Separator()) + path)[1:] - fullpath, err = cs.root.ResolveScopedPath(path, true) - if err != nil { - return "", "", fmt.Errorf("Forbidden path outside the context: %s (%s)", path, fullpath) - } - _, err = cs.root.Lstat(fullpath) - if err != nil { - return "", "", convertPathError(err, path) - } - return -} - // Hash returns a hash for a single file in the source func (cs *CachableSource) Hash(path string) (string, error) { n := cs.getRoot() diff --git a/components/engine/client/client.go b/components/engine/client/client.go index 2072b2f806..893124853f 100644 --- a/components/engine/client/client.go +++ b/components/engine/client/client.go @@ -248,8 +248,8 @@ func (cli *Client) NegotiateAPIVersionPing(p types.Ping) { cli.version = api.DefaultVersion } - // if server version is lower than the maximum version supported by the Client, downgrade - if versions.LessThan(p.APIVersion, api.DefaultVersion) { + // if server version is lower than the client version, downgrade + if versions.LessThan(p.APIVersion, cli.version) { cli.version = p.APIVersion } } diff --git a/components/engine/client/client_test.go b/components/engine/client/client_test.go index 9bde777f14..cb38d4da38 100644 --- a/components/engine/client/client_test.go +++ b/components/engine/client/client_test.go @@ -276,6 +276,14 @@ func TestNegotiateAPIVersion(t *testing.T) { // test downgrade client.NegotiateAPIVersionPing(ping) assert.Equal(t, expected, client.version) + + // set the client version to something older, and verify that we keep the + // original setting. + expected = "1.20" + client.version = expected + client.NegotiateAPIVersionPing(ping) + assert.Equal(t, expected, client.version) + } // TestNegotiateAPIVersionOverride asserts that we honor diff --git a/components/engine/daemon/network.go b/components/engine/daemon/network.go index aa03250f90..bf8a2f53d2 100644 --- a/components/engine/daemon/network.go +++ b/components/engine/daemon/network.go @@ -525,18 +525,24 @@ func (daemon *Daemon) deleteLoadBalancerSandbox(n libnetwork.Network) { if len(endpoints) == 1 { sandboxName := n.Name() + "-sbox" - if err := endpoints[0].Info().Sandbox().DisableService(); err != nil { - logrus.Errorf("Failed to disable service on sandbox %s: %v", sandboxName, err) - //Ignore error and attempt to delete the load balancer endpoint + info := endpoints[0].Info() + if info != nil { + sb := info.Sandbox() + if sb != nil { + if err := sb.DisableService(); err != nil { + logrus.Warnf("Failed to disable service on sandbox %s: %v", sandboxName, err) + //Ignore error and attempt to delete the load balancer endpoint + } + } } if err := endpoints[0].Delete(true); err != nil { - logrus.Errorf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err) + logrus.Warnf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err) //Ignore error and attempt to delete the sandbox. } if err := controller.SandboxDestroy(sandboxName); err != nil { - logrus.Errorf("Failed to delete %s sandbox: %v", sandboxName, err) + logrus.Warnf("Failed to delete %s sandbox: %v", sandboxName, err) //Ignore error and attempt to delete the network. } } diff --git a/components/engine/integration-cli/docker_cli_run_test.go b/components/engine/integration-cli/docker_cli_run_test.go index 1ad5ce7ebd..8198fded72 100644 --- a/components/engine/integration-cli/docker_cli_run_test.go +++ b/components/engine/integration-cli/docker_cli_run_test.go @@ -27,6 +27,7 @@ import ( "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/cli/build/fakecontext" "github.com/docker/docker/pkg/mount" + "github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringutils" "github.com/docker/docker/runconfig" @@ -4010,6 +4011,20 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) { } func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) { + // TODO @msabansal - https://github.com/moby/moby/issues/35023. Duplicate + // port mappings are not errored out on RS3 builds. Temporarily disabling + // this test pending further investigation. Note we parse kernel.GetKernelVersion + // rather than system.GetOSVersion as test binaries aren't manifested, so would + // otherwise report build 9200. + if runtime.GOOS == "windows" { + v, err := kernel.GetKernelVersion() + c.Assert(err, checker.IsNil) + build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0]) + if build >= 16292 { // @jhowardmsft TODO - replace with final RS3 build and == + c.Skip("Temporarily disabled on RS3 builds") + } + } + nroutines, err := getGoroutineNumber() c.Assert(err, checker.IsNil)