<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Jeet Parekh]]></title><description><![CDATA[Solutions Architect | DevOps Engineer | Data Engineer]]></description><link>https://jeetparekh.com</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 21:10:06 GMT</lastBuildDate><atom:link href="https://jeetparekh.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Transferring data across docker or podman volumes]]></title><description><![CDATA[I often find myself starting temporary containers to transfer data between the local file-system and container volumes. Or sometimes, between volumes. And the entire process is a bit tedious. Starting a temporary container, mounting the volume, mount...]]></description><link>https://jeetparekh.com/transferring-data-across-docker-podman-volumes</link><guid isPermaLink="true">https://jeetparekh.com/transferring-data-across-docker-podman-volumes</guid><category><![CDATA[Docker]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python projects]]></category><dc:creator><![CDATA[Jeet Parekh]]></dc:creator><pubDate>Tue, 25 May 2021 13:42:23 GMT</pubDate><content:encoded><![CDATA[<p>I often find myself starting temporary containers to transfer data between the local file-system and container volumes. Or sometimes, between volumes. And the entire process is a bit tedious. Starting a temporary container, mounting the volume, mounting the local file-system, and finally transferring the data.</p>
<p>So I made a python script which makes this easy. I call it <code>cvcp</code> - container volume cp (copy). It actually does not use <code>cp</code> though. It uses <code>rsync</code> for the data transfer. So it's necessary to have a container image with <code>rsync</code> installed.</p>
<p>You can find the script at https://github.com/jeet-parekh/cvcp. The repository also contains a <code>Dockerfile</code> which will build an image with <code>rsync</code> installed.</p>
<hr />
<h2 id="using-cvcp">Using cvcp</h2>
<p>Download the file <code>cvcp</code> from the repository and place it inside your preferred path. I prefer <code>~/bin</code>.</p>
<p>Then, to use <code>cvcp</code>:</p>
<pre><code class="lang-bash">cvcp SOURCE DESTINATION
</code></pre>
<p>Path inside a container volume should be written as <code>&lt;volume_name&gt;:&lt;path_inside_volume&gt;</code>.</p>
<p>Either <code>SOURCE</code> or <code>DESTINATION</code> can be a local path or a path inside a container volume. Note however that both <code>SOURCE</code> and <code>DESTINATION</code> cannot be local paths.</p>
<p>If you use <code>cvcp</code> without any options, it will pull a <code>rsync</code> image from Docker Hub, and will use docker with root (<code>sudo docker</code>).</p>
<p>The following command line options are available to customise the behaviour:</p>
<ul>
<li><p><code>--docker</code> and <code>--podman</code></p>
<ul>
<li>The container engine to use.</li>
<li>The default is <code>docker</code>.</li>
</ul>
</li>
<li><p><code>--rootless</code></p>
<ul>
<li>Use the container engine without root (without <code>sudo</code>).</li>
</ul>
</li>
<li><p><code>--image</code></p>
<ul>
<li>The container image to be used.</li>
<li>Note that the image needs to have <code>rsync</code> installed. Read the next section for more details.</li>
</ul>
</li>
<li><p><code>--rsync-opts</code></p>
<ul>
<li>Options to pass to <code>rsync</code>.</li>
<li>Note that, you need to pass all the options as a quoted string <strong>with a space at the beginning</strong>. For example, <code>' --verbose'</code>.</li>
<li>Using this option will clear the default <code>rsync</code> options used by <code>cvcp</code>, so make sure to pass all the options required.</li>
<li>The default options are <code>' -a --progress'</code>.</li>
</ul>
</li>
<li><p><code>--no-exec</code></p>
<ul>
<li>Print the command and exit.</li>
</ul>
</li>
</ul>
<hr />
<h2 id="using-a-custom-image">Using a custom image</h2>
<p>To use a custom image with <code>cvcp</code>, use the <code>--image</code> argument.</p>
<p>To permanently change the default image that <code>cvcp</code> uses, change this line in the <code>cvcp</code> script file:</p>
<pre><code class="lang-python">RSYNC_IMAGE = <span class="hljs-string">"image_name"</span>
</code></pre>
<p>It is necessary for your custom image to have <code>rsync</code> installed. You can use the Dockerfile inside the same repository as a base to build the image.</p>
<pre><code class="lang-bash"><span class="hljs-comment"># docker</span>
sudo docker build -t localhost/rsync .

<span class="hljs-comment"># podman</span>
podman build -t localhost/rsync .
</code></pre>
]]></content:encoded></item></channel></rss>