support container to container copy

Implement container to container copy.  Previously data could only be
copied from/to the host.

Fixes: #7370
Co-authored-by: Mehul Arora <aroram18@mcmaster.ca>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Mehul Arora
2021-06-19 11:27:24 +05:30
committed by Valentin Rothberg
parent b6c279be22
commit 6fe03b25ab
13 changed files with 352 additions and 26 deletions

View File

@ -23,7 +23,7 @@ import (
"golang.org/x/sys/unix"
)
func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool, reader io.Reader) (func() error, error) {
func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool, rename map[string]string, reader io.Reader) (func() error, error) {
var (
mountPoint string
resolvedRoot string
@ -89,6 +89,7 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool
GIDMap: c.config.IDMappings.GIDMap,
ChownDirs: idPair,
ChownFiles: idPair,
Rename: rename,
}
return c.joinMountAndExec(ctx,