<p>Say I have, my-namespace -> my-pod -> my-container
and I have a file located at my-container:/opt/tomcat/logs/catalina.2017-05-02.log. I have applied the below command to copy the file which isn't working,</p>

<pre><code>kubectl cp my-namepace/my-pod:/opt/tomcat/logs/catalina.2017-05-02.log -c my-container .
</code></pre>

<p>Note: I have the tar binary on my container</p>

<p>Error:</p>

<pre><code>tar: Removing leading `/' from member names
error: open .: is a directory
</code></pre>

<p>What you are asking <code>kubectl</code> to do is copy the file catalina.2017-05-02.log to the current context, but the current context is a directory. The error is stating that you can not copy a file to have the name of a directory.</p>

<p>Try giving the copied version of the file a name:</p>

<p><code>kubectl cp my-namepace/my-pod:/opt/tomcat/logs/catalina.2017-05-02.log -c my-container ./catalina.2017-05-02.log</code>.</p>
