How to copy files from a Docker container to your local desktop

Asked

Viewed 44 times

1

I am trying to copy a file from inside a Docker container using the following command:

docker cp container_id:app.txt ~/desktop/app.txt

But it returns me the following error:

invalid output path: directory "C:\\Users\\my_user\\desktop\\~\\desktop" does not exist

What I want is to copy this file app.txt to the desktop, so I tried to use the logic of cd ~/desktop, that would take the current user and enter the folder desktop, but it didn’t work.

Is there any right way to do this?

  • 1

    wouldn’t it be easier to copy to any folder and then move to the desktop? these windows paths sometimes resolve themselves

1 answer

0

By error, it seems that you are already in the Desktop directory (by the error path C:\\Users\\my_user\\desktop\\~\\desktop).

Just one point would be enough:

docker cp container_id:app.txt .
  • A comment explaining about the negative vote would help me a lot to improve the response.

  • 1

    The word haters reply to your comment? For just read carefully the question and note in path provided by AP "C:\\Users\\my_user\\desktop\\~\\desktop" that it is already in the desktop folder, thus confirming its response.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.