Sending build context to Docker daemon seems quite high

I’ve watched other people build their Dockerfile and the build context isn’t as high as mine is, I’m curious why?

Here is the output:

sudo docker build .
Sending build context to Docker daemon 841.5 MB
Step 1 : FROM ubuntu
—> 4ca3a192ff2a
Step 2 : CMD bash
—> Using cache
—> 84085f6608da
Step 3 : RUN apt-get -qq update
—> Using cache
—> 0b5db15d51c5
Successfully built 0b5db15d51c5

Any help would be appreciated, it is also my first time here so any tips about questions are appreciated also.

1 Like

The build context is all the files/directories in the current directory (the ‘.’ directory from the docker build command).

Keep only files you need for the build in this directory. That is, the Dockerfile and any local files/directories copied/added to the build image in the Dockerfile.

3 Likes

Thanks, I’ve moved the Dockerfile to its own dir now and its running much faster!

1 Like

Use .dockerignore file to exclude files/folders not relevant to the build.

3 Likes