.dockerignore

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

Contains files and directories from the build context that won't be uploaded to the docker host when the image is built. .dockerignore supports exclusion patterns similar to .gitignore.

⚠️ If a file or directory matches one of the .dockerignore patterns, it will not be possible to add it to the image with COPY.

 => ERROR [2/4] COPY ./common/docker/VERSION-base /automation                0.0s
------
 > [2/4] COPY ./common/docker/VERSION-base /automation:
------
failed to compute cache key: "/common/docker/VERSION-base" not found: not found

Also, the documentation says the semantics is similar to .gitingore's, but if a directory name is specified, it is not examined recursively. For example, if .dockerignore contains:

venv/

then a directory ./src/main/python/venv is not ignored, the full path relative to the docker context root must be specified:

src/main/python/venv/