how to rsync from a docker container to my host computer how to rsync from a docker container to my host computer kubernetes kubernetes

how to rsync from a docker container to my host computer


If you're running the rsync from the host (not inside the container), you could use docker cp instead:

e.g., docker cp containerName:/workspace/app Users/terence/workspace/app

Could you clarify:
1. are you running the rsync from the host or from inside the container?
If it's from inside the container it'll depend a lot on the --network the container is attached to (i.e., bridged or host) and also the mounted volumes (i.e., when you started up the container did you use -v flag?)

Update: For rsync to work from within the container you need to expose the host's dir to the container.

As you think of a solution, keep this in mind: host dir as a data volume

Note: The host directory is, by its nature, host-dependent. For this reason, you can’t mount a host directory from Dockerfile, the VOLUME instruction does not support passing a host-dir, because built images should be portable. A host directory wouldn’t be available on all potential hosts.