I learned the hard way. I was trying to build a python container targeted to some NLP jobs … i.e. scraping twitter … and it kept taking 10 minutes … just … to … start … the build. WTF. It would sit there with a message saying “Sending build context to Docker daemon … ” and a counter telling me how many MB it was sending. It was getting close to 2G each time … suspicious.
So I went to google and sure enough, I found an article on Codefresh explaining that every time you run the docker build command it tarball’s the entire working directory and sends it to the docker server. In my case this meant tarballing the many GB of training data I had used for my tool. (hangs head and cries)
.dockerignore to your working directory with a list of patters to ignore and you’ll save yourself a ton of time.