Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Docker build take long time in "Sending context to daemon" step?

I am pretty new to the Docker world. I am running this command:

docker build -t worker -f worker-Dockerfile-local .

This is the content of the Docker file:

FROM centos
MAINTAINER MyTeam

RUN /usr/bin/getent group worker || /usr/sbin/groupadd -r worker
RUN /usr/bin/getent passwd worker || /usr/sbin/useradd -r -g worker -s /sbin/nologin worker

# INSTALL PIP
RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
RUN python get-pip.py


ADD . /code
RUN pip install ./code

I get this message after starting this command:

Sending build context to Docker daemon 2.942 GB

My other builds take only a few seconds and the "Sending context to daemon" stage send only a few KB of data. I am not sure what's going on. Can someone help me out please?

like image 832
Bhushan Avatar asked Jul 06 '16 23:07

Bhushan


1 Answers

I solved it, silly mistake.

Seems like Docker build tars up the current working directory (i.e. the folder containing the dockerfile). And it then uploads it to the Docker Daemon for the build steps. I had accidently put a big test data file (2.9 GB) in the working directory. And that was getting included in the build context. After removing it things are back to normal.

like image 61
Bhushan Avatar answered Oct 04 '22 17:10

Bhushan