<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dockerfile on KK's Blog (fromkk)</title><link>https://fromkk.com/tags/dockerfile/</link><description>Recent content in Dockerfile on KK's Blog (fromkk)</description><generator>Hugo</generator><language>en</language><managingEditor>bebound@gmail.com (KK)</managingEditor><webMaster>bebound@gmail.com (KK)</webMaster><lastBuildDate>Sun, 10 Aug 2025 18:44:06 +0800</lastBuildDate><atom:link href="https://fromkk.com/tags/dockerfile/index.xml" rel="self" type="application/rss+xml"/><item><title>How to copy files temporarily in Dockerfile</title><link>https://fromkk.com/posts/how-to-copy-files-temporarily-in-dockerfile/</link><pubDate>Thu, 24 Aug 2023 11:49:00 +0800</pubDate><author>bebound@gmail.com (KK)</author><guid>https://fromkk.com/posts/how-to-copy-files-temporarily-in-dockerfile/</guid><description>&lt;p&gt;It&amp;rsquo;s very common to copy a local file into the container when build docker image. In general, we use &lt;code&gt;COPY&lt;/code&gt; command. But it creates a new layer and increase the final image size. If this is a temporal file and we don&amp;rsquo;t want users waste their storage space, how can we remove it? Here are some approaches.&lt;/p&gt;
&lt;h2 id="download-the-file-dynamically"&gt;Download the File Dynamically&lt;/h2&gt;
&lt;p&gt;If the file can be download from URL or you can create a local HTTP server to share the file, you can download the file, use it and delete it in one &lt;code&gt;RUN&lt;/code&gt; command. For example:&lt;/p&gt;</description></item></channel></rss>