What is the .dockerignore file used for?



  • This file is used to put entries of files & directories that you want docker build to ignore.

    e.g: If you have a build directory called stage, with the following files in it.

    Dockerfile
    tmp
    .git

    You want to ignore .git and tmp from any docker build, add them to the .dockerignore file, here's the contents of the file.

    .git
    **/*.tmp



© Lightnetics 2024