Docker Community Forums

Share and learn in the Docker community.

Build with a .dockerignore still adds a lot to context

build

(Antonio Carlos Ribeiro) #1

OS Version/build: macOS High Sierra 10.13 (17A365) - Docker version 17.10.0-ce, build f4ffd25

Having a folder with 1.4GB and no .dockerignore file, build takes a very long time to start and I get this message:

> time docker build -t continous-testing-dashboard .

Sending build context to Docker daemon  1.416GB  
...
5.23s user 11.88s system 45% cpu 37.795 total

Total time: 37 seconds

Adding (pretty much) all folders to a .dockerignore file

.git
.idea
app
bootstrap
config
database
node_modules
public
resources
storage
tests
vendor

It still takes a lot of time and sends a big context do Deamon:

> time docker build -t continous-testing-dashboard .

Sending build context to Docker daemon  675.3MB
...
17.81s user 6.78s system 86% cpu 28.439 total

Total time: 28 seconds

But building the very same Dockerfile on an empty folder I get:

Sending build context to Docker daemon  32.26kB
0.03s user 0.03s system 25% cpu 0.230 total

Total time: 230 milliseconds!!

Looks like it’s ignoring nothing, and still adding ~1/3 of the files to the context. Is there a way to make it really ignore everyhing?