I have been trying to copy a file from a remote Windows Server to my local docker image from my local docker image and I keep getting the error 'scp:Failed to open File /my/Path/test.txt'.My workaround was placing it in Documents and passed the source path '/Documents/test.txt' and it worked for a while. It has stopped working now and I get the same error. I know for a fact that I am able to ssh into the server. Any idea on how to resolve the issue or is there any better method to copy a file from a remote server to my system?


Edit 1: The error is not specific to my docker image. I get the same error when I run it from my local system.

The command is as follows :

scp user@xx.xxx.xxx.xxx:/Documents/Test.txt /path/on/docker/image/

The result is as follows :

scp: Failed to open file /Documents/Test.txt.

Edit 2: I have tried the paths 'Documents/Test.txt' as well as 'c/Users/user/Documents/Test.txt' and I still get the same error

  • Welcome to the U&L SE. Can you provide the Dockerfile you're using to build this image? Please edit the question to add that information. – Haxiel Jan 8 at 9:13
  • Well I pulled this image from Dockerhub. I did not write the docker file to build the image. This error is not specific to docker as I just tested and found out. – Nikhil Anantharaman Jan 8 at 9:39
  • In that case, can you rewrite your question to be clearer and focus on the specifics? You can refer to the Help Center for guidance. – Haxiel Jan 8 at 9:43
  • I just added this data into my edit – Nikhil Anantharaman Jan 8 at 9:45
  • Does the file exist at the absolute path /Documents/Test.txt or should that be Documents/Test.txt, i.e. relative to your home directory? – Kusalananda Jan 8 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.