Docker build: Is there a flag to specify a `.dockerignore` file, just like `-f` for Dockerfiles?

Hi,

I’m looking for a way to specify a .dockerignore file, just like -f for Dockerfiles.

We have a monorepo and want to be able to selectively copy parts of it into the Docker Build Context. Different .dockeringore files for different sub components would be very convenient.

Currently we use hacks like ln -fs .dockerignore.xyz .dockerignore, but would like to get rid of it.

Thanks for any hints!

1 Like