|
@@ -101,6 +101,7 @@ func (d Docker) ContainerAttach(cID string, stdin io.ReadCloser, stdout, stderr
|
|
func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, decompress bool) error {
|
|
func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, decompress bool) error {
|
|
srcPath := src.Path()
|
|
srcPath := src.Path()
|
|
destExists := true
|
|
destExists := true
|
|
|
|
+ destDir := false
|
|
rootUID, rootGID := d.Daemon.GetRemappedUIDGID()
|
|
rootUID, rootGID := d.Daemon.GetRemappedUIDGID()
|
|
|
|
|
|
// Work in daemon-local OS specific file paths
|
|
// Work in daemon-local OS specific file paths
|
|
@@ -124,6 +125,7 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d
|
|
// Preserve the trailing slash
|
|
// Preserve the trailing slash
|
|
// TODO: why are we appending another path separator if there was already one?
|
|
// TODO: why are we appending another path separator if there was already one?
|
|
if strings.HasSuffix(destPath, string(os.PathSeparator)) || destPath == "." {
|
|
if strings.HasSuffix(destPath, string(os.PathSeparator)) || destPath == "." {
|
|
|
|
+ destDir = true
|
|
dest += string(os.PathSeparator)
|
|
dest += string(os.PathSeparator)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -166,7 +168,7 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d
|
|
}
|
|
}
|
|
|
|
|
|
// only needed for fixPermissions, but might as well put it before CopyFileWithTar
|
|
// only needed for fixPermissions, but might as well put it before CopyFileWithTar
|
|
- if destExists && destStat.IsDir() {
|
|
|
|
|
|
+ if destDir || (destExists && destStat.IsDir()) {
|
|
destPath = filepath.Join(destPath, src.Name())
|
|
destPath = filepath.Join(destPath, src.Name())
|
|
}
|
|
}
|
|
|
|
|