How can I exclude a sub-directory with a .dockerignore file

I want to exclude a sub-directory using a .dockerignore file, but I don't know what the syntax should be, and there are no examples anywhere.

I have a sub-directory vendor/bundle.

I've put

vendor/bundle in the .dockerignore file. Also vendor/bundle/ and /vendor/bundle but none of them seem to work.

(Also, the .dockerignore file is being found, but just not working.)


There is a shorter and easier method to write your .dockerignore :

vendor/bundle/**/*
vendor/bundle