Reputation: 79
Recently i created a linode account and installed docker in ubuntu 14.04LTS i installed an image, and ran a container, everything is working properly at the moment.
I wanted to do a scp
from my local machine to linode directory and i did successfully like so.
scp file.txt root@ip:/path/to/directory
only my problem started when i realized docker container has its own root@hostname:/path/to/directory
within the linode root@ip:/
and that i did not know how to do a scp
from my local machine directly to the container path, simply because i do not know the syntax and i'm not very experienced with the process.
I looked around asked Linode for support but there was very little they could assist me with.
I decided to test some of my theories such as: instead of scp
directly to the docker container i would scp
to linode scp file.txt root@ip:/home
and from there i would do a docker cp file.txt <container-name>:/path/to/directory
after i click enter, i get no response neither error nor success.
i'm a beginner on all of this so what am i missing? what am i not understanding?
Upvotes: 1
Views: 56
Reputation: 6234
Your docker cp
aproach is right. And in fact it doesn't return any response. Your can check if the file was indeed copied using a docker exec containerid bash
.
There is another way more complicated and not recommended. If you install openssh in your container and open another port lets say -p 2222:22
you can scp directly to the container.
Of course you can do it via the docker way. Declaring a volume, linking your host directory to your container directory: -v /path/to/directory:/path/to/directory
. Then your scp to your host will work.
Regards
Upvotes: 1