How to copy a file from host to a Docker Container? Docker cp is used to copy from container to host but I am not getting any option to copy from host to Container
2 Answers
First, if you need to make this sort of change, it generally suggests that you need to rethink the architecture of your containers. Options to consider are (a) providing the file at build time via COPY comands in your Dockerfile, or (b) mounting a host directory into your container when you start it, and using that to transfer files in/out.
That said, you could probably arrange to use something like docker exec to get a file into a container:
docker exec -i mycontainer sh -c 'cat > /path/to/destination' < /path/to/source
1 Comment
SHASHI RANJAN
thanks .I also find a different way to copy the file to Docker container running on EC2 using sftp