diff --git a/builder/dockerfile/dispatchers_unix.go b/builder/dockerfile/dispatchers_unix.go index ba8e1d9053..d69e184220 100644 --- a/builder/dockerfile/dispatchers_unix.go +++ b/builder/dockerfile/dispatchers_unix.go @@ -22,7 +22,7 @@ func normalizeWorkdir(_ string, current string, requested string) (string, error if !filepath.IsAbs(requested) { return filepath.Join(string(os.PathSeparator), current, requested), nil } - return requested, nil + return filepath.Clean(requested), nil } // resolveCmdLine takes a command line arg set and optionally prepends a platform-specific diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 858d496b40..05f9e4b8af 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -4296,7 +4296,7 @@ func (s *DockerCLIBuildSuite) TestBuildBuildTimeArgExpansion(c *testing.T) { imgName := "bldvarstest" wdVar := "WDIR" - wdVal := "/tmp/" + wdVal := "/tmp" addVar := "AFILE" addVal := "addFile" copyVar := "CFILE"