-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman cp chowns files #10801
Comments
/cc @mheon @vrothberg |
@matejvasek Could you write a repeater example? |
|
diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go
index 0ab322829..09a69f8f5 100644
--- a/libpod/container_copy_linux.go
+++ b/libpod/container_copy_linux.go
@@ -63,12 +63,12 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, reader io.
}
// Make sure we chown the files to the container's main user and group ID.
- user, err := getContainerUser(c, mountPoint)
- if err != nil {
- unmount()
- return nil, err
- }
- idPair := idtools.IDPair{UID: int(user.UID), GID: int(user.GID)}
+ //user, err := getContainerUser(c, mountPoint)
+ //if err != nil {
+ // unmount()
+ // return nil, err
+ //}
+ //idPair := idtools.IDPair{UID: int(user.UID), GID: int(user.GID)}
decompressed, err := archive.DecompressStream(reader)
if err != nil {
@@ -84,8 +84,8 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, reader io.
putOptions := buildahCopiah.PutOptions{
UIDMap: c.config.IDMappings.UIDMap,
GIDMap: c.config.IDMappings.GIDMap,
- ChownDirs: &idPair,
- ChownFiles: &idPair,
+ //ChownDirs: &idPair,
+ //ChownFiles: &idPair,
}
return c.joinMountAndExec(ctx, this should fix it |
btw I find it weird because:
I would expect that it would works exactly opposite: if |
Maybe we could add the |
SGTM |
The flag is by default false meaning that by default files are not |
Yes we should match the Docker behaviour. We can add a flag to containers.conf, if people want to change the default value of this field. |
Note that @rhatdan, do you want to continue? I am not necessarily against it but want to weigh in. |
I think it is best to add the -a function and default to true to match current podman behaviour, then lets add a flag to containers.conf if people want default to Docker behaviour. |
Sub-comman
podman cp
doesn't preserve uid/git from tar. It deliberately chowns everything to uid/gid the container is running under at the moment.docker
however preserve uid/gid. Sincepodman
is drop in replacement we should do that too.If not for the
cp
CLI sub-comman then an least for docker APIv2.The text was updated successfully, but these errors were encountered: