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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With