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
docker cp
to a target file on host fails if target file is in a symlinked directory.
#31816
Comments
#dibs |
Thanks @dccurtis let us know if you need help 👍 |
Will do, so far so good! |
The root cause of this problem is that os.Lstat -> FileInfo.IsDir() returns false for a symlink directory in
I have a fix for this. I'm finishing up my testing and will have a PR out soon! |
#dibs |
@karanguptak9 Just a heads up; my fix was already approved for this. Just waiting on it to be merged. |
…directory Description: ‘docker cp’ fails with error ‘not a directory’ if a file is copied from a container to a host symlinked directory with a new target filename. The fix is to use os.Stat instead of os.Lstat since os.Stat follows the linked path. (Backport from moby#31993) It is not merged yet. Link: moby#31816 Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Fixing ‘docker cp’ to allow new target file name in a host symlinked directory Description: ‘docker cp’ fails with error ‘not a directory’ if a file is copied from a container to a host symlinked directory with a new target filename. The fix is to use os.Stat instead of os.Lstat since os.Stat follows the linked path. <br> (Backport from <a href="moby#31993" rel="nofollow noreferrer" target="_blank">https://github.com/moby/moby/pull/31993</a>) It is not merged yet. Link: <a href="moby#31816" rel="nofollow noreferrer" target="_blank">https://github.com/moby/moby/issues/31816</a> <br> Signed-off-by: Wentao Zhang <a href="mailto:zhangwentao234@huawei.com">zhangwentao234@huawei.com</a> See merge request docker/docker!632
The PR for this was merged, so I think this can be closed. |
Description
docker cp
from a file in the container to a target file on the host fails if target filename is in a symlinked directory.Steps to reproduce the issue:
On MacOS try e.g.
docker cp containerid:/bin/bash /tmp/dockerbash
(on MacOS/tmp
is a symlink toprivate/tmp
On Linux try
ln -s /tmp sl
docker cp containerid:/bin/bash sl/dockerbash
Describe the results you received:
Error message:
not a directory
, file was not created.Describe the results you expected:
File should be copied into
/tmp/dockerbash
orsl/dockerbask
Output of
docker version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: