# docker/dockerignore

> Checks that an ignore file sits beside every Dockerfile and keeps the `.git` folder, installed dependencies, and environment files out of the build.

Checks that an ignore file sits beside every Dockerfile and keeps the `.git` folder, installed dependencies, and environment files out of the build.

Part of the [`docker`](/reference/configurations/docker/) configuration, at the `recommended` [level](/start/concepts/#levels). It runs at the `commit` [stage](/start/concepts/#stage), once for the repository. gspot runs this check itself.

## Why

Without it, the daemon receives the whole folder, and a `COPY` of it puts the history and secrets into the image.

## What to do

Add a .dockerignore beside the Dockerfile with the paths the message names.

## Example

A Dockerfile with no `.dockerignore` beside it reports a finding. Add one that excludes the paths the finding names, such as `.git` and installed dependencies.

## Turn it off

Turn it off for some files, with a reason:

```shell
gspot ignore docker/dockerignore --paths "<glob>" --reason "<why>"
```
