1 Star 0 Fork 59

gnaygnil/docker

forked from src-openEuler/docker 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0132-docker-fix-docker-cp-when-container-source-path-is-root.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
gnaygnil 提交于 2020-02-13 15:36 +08:00 . docker: Fixed build error and URL
From 10fedb9c9814c584ceabfd966fa9cdbeb98ba587 Mon Sep 17 00:00:00 2001
From: liuzekun <liuzekun@huawei.com>
Date: Tue, 10 Dec 2019 03:44:18 -0500
Subject: [PATCH] docker: fix docker cp when container source path is /
reason: fix docker cp when container source path is /
Cherry-pick from upstream: https://github.com/moby/moby/pull/39357
---
components/engine/daemon/archive.go | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/components/engine/daemon/archive.go b/components/engine/daemon/archive.go
index 0bac763..f9c6fc7 100644
--- a/components/engine/daemon/archive.go
+++ b/components/engine/daemon/archive.go
@@ -255,7 +255,11 @@ func (daemon *Daemon) containerArchivePath(container *container.Container, path
if driver.Base(resolvedPath) == "." {
resolvedPath += string(driver.Separator()) + "."
}
- sourceDir, sourceBase := driver.Dir(resolvedPath), driver.Base(resolvedPath)
+ sourceDir := resolvedPath
+ sourceBase := "."
+ if stat.Mode&os.ModeDir == 0 { // not dir
+ sourceDir, sourceBase = driver.Split(resolvedPath)
+ }
opts := archive.TarResourceRebaseOpts(sourceBase, driver.Base(absPath))
data, err := archivePath(driver, sourceDir, opts, container.BaseFS.Path())
@@ -450,9 +454,6 @@ func (daemon *Daemon) containerCopy(container *container.Container, resource str
d, f := driver.Split(basePath)
basePath = d
filter = []string{f}
- } else {
- filter = []string{driver.Base(basePath)}
- basePath = driver.Dir(basePath)
}
archive, err := archivePath(driver, basePath, &archive.TarOptions{
Compression: archive.Uncompressed,
--
2.20.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gnaygnil/docker.git
git@gitee.com:gnaygnil/docker.git
gnaygnil
docker
docker
master

搜索帮助