[docker] How to copy files from host to Docker container?

Another workaround is using the good old scp. This is useful in the case you need to copy a directory.

From your host run:

scp FILE_PATH_ON_YOUR_HOST IP_CONTAINER:DESTINATION_PATH
scp foo.txt 172.17.0.2:foo.txt

In the case you need to copy a directory:

scp -r DIR_PATH_ON_YOUR_HOST IP_CONTAINER:DESTINATION_PATH
scp -r directory 172.17.0.2:directory

be sure to install ssh into your container too.

apt-get install openssh-server