How can you ensure that some files will be ignored by a build process and won't be copied as part of COPY instruction that is defined in a Dockerfile?

Experience Level: Senior
Tags: Docker

Answer

To exclude files not relevant to the build (without restructuring your source repository) use a .dockerignore file. This file supports exclusion patterns similar to .gitignore files. For information on creating one, see the .dockerignore file.

Comments

No Comments Yet.
Be the first to tell us what you think.
Docker instructions
Docker instructions

Are you learning Docker ? Try our test we designed to help you progress faster.

Test yourself