title: Should .dockerignore typically be a superset of .gitignore?
body: <p>Let's focus on a scenario where both Docker and Git are used in a project. In this case it's convenient to maintain both <code>.gitignore</code> and <code>.dockerignore</code> files.</p>
  
  <p>I'm trying to understand the relation between the two files. My beginner's suspicion is that <code>.dockerignore</code> should be a superset of <code>.gitignore</code> and always contain at least the same items.</p>
  
  <p>My reasoning is that if the <code>.dockerignore</code> doesn't list some file that is <code>.gitignored</code>, then our build context on the developer's machine will include this file whereas a build context in the Continuous Integration environment won't (as it only works on files present in the git repository). This can easily lead to a situation where a docker image built locally works, but an image build from the same code on the build server is broken, because it works with a different input data.</p>
  
  <p><strong>Is this true that <code>.dockerignore</code> should typically be a superset of <code>.gitignore</code>?</strong> If so, do you actually use some tooling to enforce this relation?</p>