Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

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.)

like image 508
Lukas Oberhuber Avatar asked Jul 02 '15 10:07

Lukas Oberhuber


People also ask

Where do I put my Dockerignore file?

The . dockerignore file is a special file that can be placed within the build context directory. The build context directory is the directory that we specify at the end of a docker build command.


1 Answers

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

vendor/bundle/**/* vendor/bundle 
like image 74
sebthemonster Avatar answered Sep 21 '22 13:09

sebthemonster