Elessar.perm
Elessar.perm

Reputation: 811

Why docker build is so slow

My docker is very slow when I'm trying to build images on my laptop. I tried to build same image at my ubuntu inside virtual machine with same docker version and it builds it in 5 seconds, but on my laptop it evaluates every statement like 30 times slower. Even ENV command!

Laptop uses OpenSUSE 42.2 Leap with Btrfs as root file system, HDD with 5400 rpm and also it's encrypted. I know all these factors but are they so significant that my build takes 15mins instead of 5sec?

Docker 1.13.1.

Thanks.

UPD.

not sure if it helps or not, but when I run docker build -t test . on my virtual machine, it uses 10% of my 4-core CPU for 5 secs and heavilly uses HDD.

however on laptop it uses one core of my 4-core CPU for 100% all the time and HDD remains idle almost all the time.

here is nmon statistics: enter image description here

Upvotes: 18

Views: 35281

Answers (2)

abdollar
abdollar

Reputation: 3415

This sounds like your laptops btrfs filesystem is having issues - as in it's fragmented. Try looking into tuning btrfs. I would also look into this section of the docker documentation related to docker and btrfs - specifically the section on performance which points to fragmentation.

Upvotes: 7

JoelFan
JoelFan

Reputation: 38704

Not sure if this was the same problem but just made my build go from 5 minutes to 5 seconds, by adding the following .dockerignore file to the same directory as my docker-compose.yml file.

**/bin
**/obj
**/node_modules
.git

Upvotes: 18

Related Questions