0

docker-machine has an scp command, but docker-cloud doesn't seem to have any way to transfer a file from my local machine to the cloud container or vice-versa.

I'm submitting an answer below that I've finally figured out (in hopes that it will help someone), but I'd love to hear better answers if there are any!

(I realize docker-cloud is going away, but perhaps this will be helpful for other cloud platforms as well)

mltsy
  • 6,598
  • 3
  • 38
  • 51

1 Answers1

0

To transfer a file from your local machine to a docker-cloud instance that is running linux with the tee command available:

docker-cloud container exec id12345 tee filename.ext < file_to_copy.ext > /dev/null

(you'll want to redirect output to /dev/null as shown unless you want the entire contents of the file to be echoed to the terminal... twice)

To transfer a file to your local machine, is somewhat easier:

docker-cloud container exec id12345 cat file_to_copy.ext > filename.ext

Note: I'm not sure this works for binary files, and it can even cause issues with linefeed characters in text files, based on terminal settings, etc. - but it's the best answer I've got short of using an external service like https://transfer.sh

mltsy
  • 6,598
  • 3
  • 38
  • 51