Docker ignores patterns in .dockerignore : <p>I intended to exclude python generated files from the docker image. So I added <code>.dockerignore</code> at the root of the context directory:</p>

<pre><code># Ignore generated files
*.pyc
</code></pre>

<p>Alas <code>docker build</code> ignores this and copies the entire directory tree that looks like the following:</p>

<pre><code>/contextdir/
|-- Dockerfile
\-- src/
    |-- a.py   # this is copies - all right
    \-- a.pyc  # this should be ignored, but is copied too. Why?
</code></pre>
