title: How to create an empty file in a scratch container?
body: <p>How to create an empty file in a scratch container in a Dockerfile?</p>
  
  <h3>Try 1</h3>
  
  <p>Obviously, <code>touch</code> is not available:</p>
  
  <pre><code>FROM scratch
  RUN ["touch", ".emptyfile"]
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>container_linux.go:265: starting container process caused "exec: \"touch\": executable file not found in $PATH"
  </code></pre>
  
  <hr>
  
  <h3>Try 2</h3>
  
  <p>Unfortunately, <code>/dev/null</code> is not available either:</p>
  
  <pre><code>FROM scratch
  COPY /dev/null .emptyfile
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>COPY failed: stat /var/lib/docker/tmp/docker-builder872453691/dev/null: no such file or directory
  </code></pre>
  
  <hr>
  
  <p>I could create an empty file in the Docker host build context and then <code>COPY</code> it, but you know, that would be too easy.</p>
  
  <p>Any ideas?</p>