Execute command on host during docker build : <p>Is it possible to create <code>Dockerfile</code> that executes a command on host when image is being build?</p>

<p><strong>Now I'm doing:</strong></p>

<pre><code>./script_that_creates_magic_file.sh
docker build .
</code></pre>

<p>with Dockerfile:</p>

<pre><code>FROM alpine
COPY magic_file
</code></pre>

<p><strong>I want to be able to do:</strong></p>

<pre><code>docker build .
</code></pre>

<p>with Dockerfile:</p>

<pre><code>FROM alpine
# invoke script_that_creates_magic_file.sh on the host
COPY magic_file
</code></pre>

<p>Of course, this script is in the same directory as Dockerfile.</p>
