I am trying to run following:
docker run -dit -p 8090:80 --name container repository:dockerfile bash
/data
from /test
docker cp /Users/$USER/test container:/test
docker exec rsync -avP --exclude /Users/$USER/test/data /Users/$USER/test/ container:/test/
I get below error:
rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.0]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226)
[sender=3.1.0]
How do I rsync from host to container?
The way to use rsync to copy files into a Docker container
Make sure your Docker container has rsync installed, and define this alias:
alias drsync="rsync -e 'docker exec -i'"
Now, you can use rsync with containers as if they are remote machines:
drsync -av /source/ container:/destination/
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