docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 118 forks source link

Sending build context to Docker daemon seems (slow) to take longer the more times a build command is run. #137

Closed blackdynamo closed 7 years ago

blackdynamo commented 8 years ago

Expected behavior

Start the build immediately and not take 1-2 min to "Sending build context to Docker daemon 163.4 MB".

Actual behavior

Seems like this takes longer and longer every time I run a build.

Information

I believe it's the number of times build is run, but not 100% sure. I have tried restarting the docker for mac client but doesn't seem to make a difference.

Attached is a video that should be self explanatory. You will see it takes over a minute to even get started: Video

Docker for Mac: version: mac-v1.12.0-beta21.1
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/068F3FB8-9F46-4D4D-A71B-D4C770E89080/20160804-184126.tar.gz
[OK]     docker-cli
[OK]     app
[OK]     moby-syslog
[OK]     disk
[OK]     virtualization
[OK]     system
[OK]     menubar
[OK]     osxfs
[OK]     db
[OK]     slirp
[OK]     moby-console
[OK]     logs
[OK]     vmnetd
[OK]     env
[OK]     moby
[OK]     driver.amd64-linux
FROM node

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
  liblapack-dev \
  libblas-dev \
  libboost-dev \
  libarmadillo-dev

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install

# Build addons
COPY includes /usr/src/app/includes
COPY shared /usr/src/app/shared
COPY src /usr/src/app/src
COPY binding.gyp /usr/src/app/
RUN npm run build:addons

# Bundle app source
COPY . /usr/src/app
RUN npm run symlink:lib

EXPOSE 8081

CMD [ "npm", "start" ]

Steps to reproduce the behavior

See video.

ondrowan commented 8 years ago

I'm having the same problem since I switched from beta to stable channel (or maybe it's just related to Docker version).

Diagnose & Feedback output:

Docker for Mac: version: mac-v1.12.0.1
OS X: version 10.11.6 (build: 15G1004)
logs: /tmp/3379F485-FF43-4197-A20B-A7EB79DBB455/20160906-173002.tar.gz
[OK]     docker-cli
[OK]     app
[OK]     moby-syslog
[ERROR]  disk
         disk check failed with: Failure("exec: /Applications/Docker.app/Contents/Resources/bin/../../../Contents/MacOS/qemu-img check /Users/ondrej/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 > /tmp/3379F485-FF43-4197-A20B-A7EB79DBB455/20160906-173002/qemu-img-check.stdout 2> /tmp/3379F485-FF43-4197-A20B-A7EB79DBB455/20160906-173002/qemu-img-check.stderr: exit 2")
[OK]     virtualization
[OK]     system
[OK]     menubar
[OK]     osxfs
[OK]     db
[OK]     slirp
[OK]     moby-console
[OK]     logs
[OK]     vmnetd
[OK]     env
[OK]     moby
[OK]     driver.amd64-linux

I guess the disk error is related to some other issue.

dave-tucker commented 7 years ago

Hi @blackdynamo and @ondrowan does this problem still reproduce on Beta 26 or the latest stable 1.12.1?

blackdynamo commented 7 years ago

@dave-tucker It doesn't happen as often. I haven't noticed it within the last week. Will keep an eye out this week and report back if it happens this week.

For now as a work around when it does happen, I just reset docker for Mac and it fixes whatever is causing the problem.

Thanks.

dave-tucker commented 7 years ago

Thanks @blackdynamo in that case I'll close the issue for now. When you do see it again, please send us a fresh issue report and we'll investigate further!

elhoyos commented 7 years ago

I'm currently in beta on Version 17.03.0-ce-rc1-mac1 (15471) and currently experiencing this exact issue. Very frustrating because I cannot move forward with this slowness.

Any logs or info I can help with?

blackdynamo commented 7 years ago

Hey @elhoyos, I was having this issue and then it was fixed. Then I started seeing it again and realized it was a user error. For me, I am using node and with that comes node_modules. I found that if I deleted the node_modules folder, it dramatically reduced the size of the context being sent to docker.

If you are also using node or something that potentially has large files/dependencies, you can add those files/folders to a .dockerignore file. This file works is formatted similar to .gitignore. See here for some documentation around the .dockerignore file.

ezaki-viv commented 5 years ago

Try placing the Dockerfile in a separate folder and build it and it won't take time. This happens because of the files and folders present in the working directory. In case of executing it under a new folder, it has nothing to upload so it will finish within a moment.

MarcusYRH commented 5 years ago

Try placing the Dockerfile in a separate folder and build it and it won't take time. This happens because of the files and folders present in the working directory. In case of executing it under a new folder, it has nothing to upload so it will finish within a moment.

This did it for me. Particularly so if your working directory has huge files present

hlongmore commented 4 years ago

If you want more information as to why placing the Dockerfile in a separate directory works, you can check out this article: https://codefresh.io/docker-tutorial/not-ignore-dockerignore-2/

docker-robott commented 4 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked