Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up docker-compose build w/ cloud docker-machine? #2090

Closed
abulte opened this issue Sep 24, 2015 · 4 comments
Closed

Speed up docker-compose build w/ cloud docker-machine? #2090

abulte opened this issue Sep 24, 2015 · 4 comments

Comments

@abulte
Copy link

abulte commented Sep 24, 2015

Hi,

I'm using docker-compose + docker-machine to deploy my services on remote cloud machines. I noticed that the first phase of the docker-compose build is very slow for me w/ a decent internet connection (typically between 3 mins and 15 minutes).

When running with --verbose the slow phase is docker build <- (pull=False, nocache=False, stream=True, tag=u'backenddev_web', path='XXX', rm=True, dockerfile='Dockerfile-production')

From what I can see from the activity monitor of my laptop, this is a phase where some data upload is being done. I also noticed that the time decreases if I decrease the size of the directory I'm building from. The upload speed during this phase is between 100Ko/s and 200Ko/s, wether I'm building on a Google Compute or Digital Ocean - which feels quite slow. I should be able to upload at least 800Ko/s.

Any idea how to speed things up or dig deeper into my problem?

Thanks.

@dnephin
Copy link

dnephin commented Sep 24, 2015

The first part of build is to upload the build context to the docker engine. The build context is everything in the directory and in sub-directories. If you have large data files, or a large .git, you may be uploading a lot of unnecessary stuff. .dockerignore was added so you can skip any files you don't want to upload.

https://docs.docker.com/reference/builder/#dockerignore-file

@abulte
Copy link
Author

abulte commented Sep 24, 2015

This should help, already 10M saved w/ ignoring .git! Thanks.

@dnephin
Copy link

dnephin commented Sep 24, 2015

Great!

@dcalsky
Copy link

dcalsky commented Sep 11, 2019

The first part of build is to upload the build context to the docker engine. The build context is everything in the directory and in sub-directories. If you have large data files, or a large .git, you may be uploading a lot of unnecessary stuff. .dockerignore was added so you can skip any files you don't want to upload.

https://docs.docker.com/reference/builder/#dockerignore-file

I have to give a big like to you, your answer really solves my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants