Bartosz Bierkowski - Low dose cloud

OpenShift Morsels: rsync – getting files from and to a pod

On Day #6 lets step away for a moment from troubleshooting the pods and have a look at getting files from pods.

Linux has a nice command to copy files between two locations in an efficient way. Yes, you guessed, it is called rsync . OpenShift oc client also has this little, but useful functionality.

There are two main usages – getting files from the pod to local disk and uploading files from local disk to the pod.

The syntax is the same just the same for both use cases:

oc rsync <source> <destination>  – where one parameter is pod directory and the other local directory.

oc rsync <pod>:<path-in-pod> <local-path>  – downloading files from pod

oc rsync <local-path> <pod>:<path-in-pod>  – uploading files to pod

In the example below you can see that the files are downloaded from pod to the local folder. Using . as pod path will use workdir as the pod directory. You still have to provide the pod name.

And of course trying to sync two pods this way or two local directories does not work.


oc rsync --help – always worth checking for hidden gems. – some OpenShift docs about the command with more examples. You can also find out there what tools are needed for the command to work for both Linux and Windows.


The commands were executed using minishift and the following client/server versions of OpenShift.

oc v3.6.1+008f2d5
client kubernetes v1.6.1+5115d708d7
openshift v3.6.0+c4dd4cf
server kubernetes v1.6.1+5115d708d7


Thanks for reading the OpenShift morsels. To get updates about new articles, you can sign up to the newsletter below.

As a thank you message, you will also get access to OpenShift CLI CheatSheet listing most commonly used commands together with a short explanation.

Did you like the article?
Join the newsletter to receive notifications about new articles.
I respect your privacy.