2

How to copy file from docker container of remote server to local machine

punit pandey
  • 81
  • 1
  • 7
  • Does this answer your question? [Copying files from Docker container to host](https://stackoverflow.com/questions/22049212/copying-files-from-docker-container-to-host) – punit pandey Dec 01 '19 at 20:50

1 Answers1

3

docker to remote server Use: docker cp [Container Id]:/[absolute file location on container] [remote server location to save file]

Ex: docker cp d3e014rt404a:/usr/local/project/log.txt log.txt

remote server to local Use: scp [user]@[remote_address]/[file_location] [local file location]

Ex: scp user@11.11.101.101:/home/user/log.txt log.txt

Farzad Vertigo
  • 2,458
  • 1
  • 29
  • 32
punit pandey
  • 81
  • 1
  • 7
  • 3
    `ssh` accepts a command a parameter, e.g. can: `ssh user@host "docker cp container:/path/to/file.txt /path/to/output/file.txt" && scp user@host:/path/to/output/file.txt .` – masseyb Dec 02 '19 at 08:07