Open adoyle-h opened 7 years ago
I think it is due to some large files still omitted to ignore.
Is there any method to help detect the problem? Maybe Sending build context to Docker daemon XXX MB
message is helpful.
Hi @adoyle-h. Hi need to investigate if I get the the size of the building context from the docker deamon API. Will put this on my todo list. Thanks for reaching out.
For anyone interested: The docker-build implementation seems to be here: https://github.com/docker/cli/blob/82a80858857aeeb37008bd7d2f4afcda3d39c966/cli/command/image/build.go#L333
Okay, so it turns out that habitus relies on go-dockerclient and passes build context as a directory path rather than io.Reader
which is required in order to calculate the progress.
Habitus: https://github.com/cloud66/habitus/blob/5d45985f7af33d1a6bcbb5c782f80fcf39b829da/build/builder.go#L267 go-dockerclient: https://github.com/fsouza/go-dockerclient/blob/cb0ae363fa010610c248eb6a397aa72345b4b406/image.go#L489 Official docker client: https://github.com/moby/moby/blob/3a633a712c8bbb863fe7e57ec132dd87a9c4eff7/client/image_build.go#L21
Fortunately, we can switch habitus to pass an InputStream
. The input stream could be created from a tar stream and can we wrapped with a progress reader to achieve what we want.
I am building a large project with many sub-projects (the file structures are complex) and the habitus hangup in long period.
My
build.yml
is simple for test:I run the habitus in my local image
habitus:runner
built based on the latest source code. And run the script to start building:I have tried to build a simple repo with the same docker image and shell scripts, it works.
I noticed that the building get slower when I generated a 1GB file with
truncate -s 1G block
in the work directory. It will get back to normal when set.dockerignore
to ignore theblock
file.Although I have ignored many things in the large project via
.dockerignore
, it still hang. How can I debug the habitus server?